This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

troubles with defineClass and Binary Compatibility on ARM-Linux


Hi,
   I'm having problems on ARM (arm-unknown-linux-gnu) which don't show
up on FC4 with GCC 4.0.2 20051125.

The software is Knopflerfish OSGi. From my understanding it is a typical
case for the Binary Compatibility ABI: lots of custom ClassLoaders that
call defineClass. This is similar to some of what Eclipse does.

The software is set up as a core framework that loads "bundle" classes
from jars through "BundleClassLoaders".

I've based my work on the information available at
http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ

I do the following:

I use a lightly customized "build-db.sh" that I copied from the
ClassapthShowCase Native Eclipse HOWTO:
http://developer.classpath.org/mediation/ClasspathShowcase#head-7d9a556e8485fc84fd5ce0e52be6104d85e24316

the root directory has framework.jar
the jar directory has all the bundles to be loaded

so on x86 FC4 I run
1- ./build-db.sh this build kf.db

2- gcj -findirect-dispatch -Wl,-Bsymbolic -fjni -lgij framework.jar -o
kf

3- ./kf -Dgnu.gcj.precompiled.db.path=kf.db -verbose:class -jar
framework.jar -init

I can see that the native code gets used:

for framework:

[Loaded (BC-compiled) org.knopflerfish.framework.ListenerEntry from <no
code source>]

Some classes get BC-compiled others get pre-compiled, ex:
[Loaded (pre-compiled) org.osgi.framework.SynchronousBundleListener from
<no code source>]

for bundles:
[Loaded (BC-compiled) org.knopflerfish.bundle.log.LogConfigImpl from
(null <no certificates>)]
and
[Loaded (pre-compiled) org.knopflerfish.service.console.ConsoleService
from (null <no certificates>)]

If instead I run 
./kf -verbose:class -jar framework.jar -init

I get

for framework:

[Loaded (BC-compiled) org.knopflerfish.framework.Util from <no code
source>]

for bundles:

[Loaded (bytecode) org.knopflerfish.bundle.log.LogConfigImpl from (null
<no certificates>)]

So all is happy on x86.


Now on ARM,

I do 

1- ./build-db.sh  - this build kf.db using the correct cross-gcj and the
x86 FC4 gcj-dbtool (I'm assuming the DB format does not matter across
ARCH, although it does matter across GCJ versions - I get
java.lang.NoClassDefFoundError if I use the 4.0.2 toolchain to generate
a db for 4.2 runtime, even though nm reveals that the symbols are there)

I'm using scratchbox with the Nokia 770 fro cross-development. For what
is needed here scratchbox is like chroot. Since the paths stored in
kf.db are absolute I make sure to put the .so files in the same path in
the chroot environment as the one in which they are built.

2-  arm-unknown-linux-gnu-gcj -findirect-dispatch -Wl,-Bsymbolic -fjni
-lgij framework.jar -o kf

3- ./kf -Dgnu.gcj.precompiled.db.path=kf.db -verbose:class -jar
framework.jar -init


With the gcc-4.2-20060617-glibc-2.3.2/arm-unknown-linux-gnu toolchain,

[Loaded (BC-compiled) org.knopflerfish.framework.BundleImpl from <no
code source>]
[Loaded (pre-compiled) org.osgi.framework.Bundle from <no code source>]
[Loaded (BC-compiled) org.knopflerfish.framework.Debug from <no code
source>]
[Loaded (pre-compiled) java.lang.InterruptedException from <no code
source>]
[Loaded (pre-compiled) java.lang.NumberFormatException from <no code
source>]
[Loaded (pre-compiled) java.net.MalformedURLException from <no code
source>]
[Loaded (pre-compiled) java.lang.NoClassDefFoundError from <no code
source>]
[Loaded (pre-compiled) java.lang.LinkageError from <no code source>]
Exception in thread "main" [Loaded (pre-compiled) java.lang.Throwable
$StaticData from <no code source>]
java.lang.NullPointerException
   <<No stacktrace available>>


How can I get more debug info, like a stacktrace? From the classes being
loaded output I can get a hunch...but


With the gcc-4.0.2-glibc-2.3.2/arm-unknown-linux-gnu toolchain, things
are different.

I get
## DEBUG: errors - FrameworkErrorEvent bundle #1
## DEBUG: errors - FrameworkErrorEvent throwable: 
[Loaded (pre-compiled) gnu.gcj.runtime.NameFinder from <no code source>]
[Loaded (pre-compiled) java.lang.ConcreteProcess from <no code source>]
[Loaded (pre-compiled) java.lang.Process from <no code source>]
[Loaded (pre-compiled) java.lang.ConcreteProcess$ProcessManager from <no
code source>]
[Loaded (pre-compiled) java.util.LinkedList from <no code source>]
[Loaded (pre-compiled) java.util.AbstractSequentialList from <no code
source>]
[Loaded (pre-compiled) java.util.LinkedList$Entry from <no code source>]
[Loaded (pre-compiled) java.lang.StackTraceElement from <no code
source>]
[Loaded (pre-compiled) java.lang.Throwable$StaticData from <no code
source>]
Nested bundle exception:
org.osgi.framework.BundleException: BundleActivator start failed
   at org.knopflerfish.framework.BundleImpl.start0() (Unknown Source)
   at
org.knopflerfish.framework.PermissionOps.callStart0(org.knopflerfish.framework.BundleImpl) (Unknown Source)
   at .$a (Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl.increaseStartLevel()
(Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl$1.run() (Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl.run() (Unknown Source)
   at java.lang.Thread.run() (/usr/lib/libgcj.so.6)
Caused by: java.lang.NullPointerException
   at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int,
int) (/usr/lib/libgcj.so.6)
   at org.knopflerfish.framework.BundleClassLoader
$1.get(java.util.Vector, java.lang.String, java.lang.String,
java.lang.String, org.knopflerfish.framework.BundleClassLoader,
org.knopflerfish.framework.BundleArchive) (Unknown Source)
   at .$a (Unknown Source)
   at
org.knopflerfish.framework.PermissionOps.callSearchFor(org.knopflerfish.framework.BundleClassLoader, java.lang.String, java.lang.String, java.lang.String, org.knopflerfish.framework.BundleClassLoader$SearchAction, boolean, org.knopflerfish.framework.BundleClassLoader, java.util.HashSet) (Unknown Source)
   at
org.knopflerfish.framework.BundleClassLoader.findClass(java.lang.String)
(Unknown Source)
   at
org.knopflerfish.framework.BundleClassLoader.loadClass(java.lang.String,
boolean) (Unknown Source)
   at java.lang.ClassLoader.loadClass(java.lang.String)
(/usr/lib/libgcj.so.6)
   ...6 more
java.lang.NullPointerException
   at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int,
int) (/usr/lib/libgcj.so.6)
   at org.knopflerfish.framework.BundleClassLoader
$1.get(java.util.Vector, java.lang.String, java.lang.String,
java.lang.String, org.knopflerfish.framework.BundleClassLoader,
org.knopflerfish.framework.BundleArchive) (Unknown Source)
   at .$a (Unknown Source)
   at
org.knopflerfish.framework.PermissionOps.callSearchFor(org.knopflerfish.framework.BundleClassLoader, java.lang.String, java.lang.String, java.lang.String, org.knopflerfish.framework.BundleClassLoader$SearchAction, boolean, org.knopflerfish.framework.BundleClassLoader, java.util.HashSet) (Unknown Source)
   at
org.knopflerfish.framework.BundleClassLoader.findClass(java.lang.String)
(Unknown Source)
   at
org.knopflerfish.framework.BundleClassLoader.loadClass(java.lang.String,
boolean) (Unknown Source)
   at java.lang.ClassLoader.loadClass(java.lang.String)
(/usr/lib/libgcj.so.6)
   at
org.knopflerfish.framework.PermissionOps.callStart0(org.knopflerfish.framework.BundleImpl) (Unknown Source)
   at .$a (Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl.increaseStartLevel()
(Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl$1.run() (Unknown Source)
   at org.knopflerfish.framework.StartLevelImpl.run() (Unknown Source)
   at java.lang.Thread.run() (/usr/lib/libgcj.so.6)




BSD-licensed Knopflerfish can be downloaded from
http://www.knopflerfish.org/releases/2.0-beta-2/knopflerfish_fullbin_osgi_2.0-beta-2.jar

set
-Dorg.knopflerfish.framework.debug.errors=true
-Dorg.knopflerfish.framework.debug.classloader=true
to turn on debug output


Thanks in advance for any help,
-- 
Philippe Laporte 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]