Thanks,
I added the code and compiles on scratchbox...in that environement I get :
******* NATIVE LIB OPEN /usr/local/classpath/lib/classpath/libjavanio.so
The verbose output is attaches as txt. When I copy this over to the native platform I now get cannot open binary file...I am verifiying that the code changes you asked are doing this.
On 10/8/07, Robert Lougher <rob.lougher@xxxxxxxxx> wrote:
Hi Larry,
On 10/8/07, Larry Suto <larry.suto@xxxxxxxxx > wrote:
> Thanks for the info....I am compiling with the defaults and when I copy the
> files over to the target I am placing them in a linux filesystem at the
> default locations and then I nfs mount it to the target and the I chroot .
> in the mounted directory so it seems like I have the files in the default
> location
>
> I tried the override and it seems like it went further:
>
> ./jamvm
> -Xbootclasspath:/usr/local/jamvm/share/jamvm:/usr/local/classp
> ath/share/classpath
> -Dgnu.classpath.boot.library.path=/usr/local/classpath/lib/c
> lasspath Test
> Exception occurred while VM initialising.
> java/lang/NoClassDefFoundError: java/lang/Thread
>
No, java.lang.Thread is the first class JamVM attempts to load, so
it's failed almost immediately. It looks like you've specified the
bootclasspath wrong... Have a look in /usr/local/jamvm/share/jamvm
and /usr/local/classpath/share/classpath. The classes should be in
classes.zip and glibj.zip. This needs to be specified (i.e.
-Xbootclasspath:/usr/local/jamvm/share/jamvm/classes.zip:/usr/local/classpath/share/classpath/glibj.zip).
But this is irrelevant. By using chroot the classes should look like
they're in the right place anyway.
My guess would be that JamVM is finding the library correctly, but a
dependency is failing, so the dlopen fails. You'll need to add a
debug printf to discover the cause.
In jamvm/src/os/linux/os.c
change:
void *nativeLibOpen(char *path) {
return dlopen(path, RTLD_LAZY);
}
to
void *nativeLibOpen(char *path) {
void *ret;
printf("******** NATIVE LIB OPEN %s\n", path);
ret = dlopen(path, RTLD_LAZY);
if(ret == NULL)
printf("DLOPEN FAILED %s\n", dlerror());
return ret;
}
Also, when running the test, please add -verbose -verbose:jni this
will indicate whether JamVM is finding the boot classes, and what JNI
methods it's trying to call.
Rob.
> for jamvm I use ./configure
> for classpath I use ./configure --with-jikes --enable-jni --disable-gtk-peer
> --disable-gconf-peer --disable-plugin
>
>
> On 10/8/07, Robert Lougher < rob.lougher@xxxxxxxxx> wrote:
> > Hi,
> >
> > On 10/8/07, Christian Thalinger <twisti@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > > On Mon, 2007-10-08 at 01:42 -0700, Larry Suto wrote:
> > > > Hi I am trying to get classpath .93 compiled for a Marvell ARM5
> > > > processor.....I can compile in the scratchbox crosscompile environment
> > > > without any problems...but if copy the classpath files over to the
> > > > native environmentI get this error from jamvm
> > > >
> > > > sh-2.05b# ./gjar
> > > > Cannot create system class loader
> > > > Exception occured while printing exception
> > > > (java/lang/NoClassDefFoundError)...
> > > > Original exception was java/lang/UnsatisfiedLinkError
> > >
> > > Can you run JamVM with -verbose:jni to see which native method is
> > > failing?
> > >
> > > - twisti
> > >
> >
> > Could you also provide details of how you configured/built JamVM and
> Classpath?
> >
> > In general, there are two common problems people have when
> > cross-compiling JamVM :
> >
> > 1) They configure JamVM/Classpath on the host to install in one place,
> > and then copy the files to somewhere else on the target. This doesn't
> > work, because JamVM builds at compile time default boot class and
> > library paths based on where it was configured to be installed.
> >
> > By default, JamVM is installed in /usr/local/jamvm, and Classpath
> > /usr/local/classpath. You can change the place using --prefix=xxx
> > when running configure. If you also move Classpath, you need to tell
> > JamVM this by using the --with-classpath-install-dir=xxx
> configure
> > option (this should be set to the --prefix value you gave to
> > Classpath's configure).
> >
> > You can also override the defaults at runtime, e.g.
> >
> > jamvm
> -Xbootclasspath:/path/to/JamVMs/classes.zip:/path/to/Classpaths/glibj.zip
> >
> -Dgnu.classpath.boot.library.path=/path/to/Classpaths/lib/dir
> ...
> >
> > 2) Copying Classpath onto a fat/vfat formatted device.
> >
> > When Classpath is built, libtool creates library names with version
> > numbers in them, and creates symbolic links for shorter forms (from
> > memory) :
> >
> > libX.so.0.0.0
> > libX.so.0 -> libX.so.0.0
> > libX.so -> libX.so.0
> >
> > The problem is fat/vfat does not support symbolic links, so the short
> > forms are lost when Classpath is copied onto it.
> >
> > Either:
> >
> > a) For each library in .../classpath/llib/classpath rename
> > libX.so.0.0.0 to libX.so
> >
> > or,
> >
> > b) Use tar and the -h option to follow the sybolic links. However,
> > this will create 3 versions of each library when you unpack, so you
> > should delete the libX.so.0, and libX.so.0.0 versions.
> >
> >
> > Hope this helps,
> >
> > Rob.
> >
>
>
[Loaded java/lang/Object from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Object] [Loaded java/io/Serializable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/Serializable] [Loaded java/lang/reflect/Type from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/reflect/Type] [Loaded java/lang/reflect/AnnotatedElement from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/reflect/AnnotatedElement] [Loaded java/lang/reflect/GenericDeclaration from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/reflect/GenericDeclaration] [Loaded java/lang/Class from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Class] [Loaded java/lang/Runnable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Runnable] [Loaded java/lang/Thread from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Thread] [Loaded java/lang/VMThread from /usr/local/jamvm/share/jamvm/classes.zip] [Linking class java/lang/VMThread] [Loaded java/lang/Comparable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Comparable] [Loaded java/lang/CharSequence from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/CharSequence] [Loaded java/lang/String from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/String] [Loaded java/lang/Cloneable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Cloneable] [Created primitive class char] [Created array class [C] [Loaded gnu/classpath/VMStackWalker from /usr/local/jamvm/share/jamvm/classes.zip] [Linking class gnu/classpath/VMStackWalker] [Dynamic-linking native method gnu.classpath.VMStackWalker.getCallingClassLoader ... internal] [Loaded java/lang/VMClass from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/VMClass] [Dynamic-linking native method java.lang.VMClass.forName ... internal] [Created array class [Ljava/lang/Thread;] [Dynamic-linking native method java.lang.VMClass.getComponentType ... internal] [Loaded java/lang/Thread$UncaughtExceptionHandler from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Thread$UncaughtExceptionHandler] [Loaded java/lang/ThreadGroup from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/ThreadGroup] [Loaded java/lang/Iterable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Iterable] [Loaded java/util/Collection from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Collection] [Loaded java/util/List from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/List] [Loaded java/util/RandomAccess from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/RandomAccess] [Loaded java/util/AbstractCollection from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/AbstractCollection] [Loaded java/util/AbstractList from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/AbstractList] [Loaded java/util/Vector from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Vector] [Created array class [Ljava/lang/Object;] [Loaded java/lang/StackTraceElement from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/StackTraceElement] [Created array class [Ljava/lang/StackTraceElement;] [Loaded java/lang/VMThrowable from /usr/local/jamvm/share/jamvm/classes.zip] [Linking class java/lang/VMThrowable] [Loaded java/lang/Throwable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Throwable] [Loaded java/lang/Error from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/Error] [Loaded java/lang/VirtualMachineError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/VirtualMachineError] [Loaded java/lang/OutOfMemoryError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/OutOfMemoryError] [Dynamic-linking native method java.lang.VMThrowable.fillInStackTrace ... internal] [Created primitive class int] [Created array class [I] [Loaded java/nio/Buffer from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/Buffer] [Loaded java/nio/ByteBuffer from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/ByteBuffer] [Loaded java/nio/DirectByteBufferImpl from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/DirectByteBufferImpl] [Loaded gnu/classpath/Pointer from /usr/local/classpath/share/classpath/glibj.zip] [Linking class gnu/classpath/Pointer] [Loaded gnu/classpath/Pointer32 from /usr/local/classpath/share/classpath/glibj.zip] [Linking class gnu/classpath/Pointer32] [Loaded java/lang/LinkageError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/LinkageError] [Loaded java/lang/NoClassDefFoundError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/NoClassDefFoundError] [Loaded java/lang/ClassFormatError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/ClassFormatError] [Loaded java/lang/IncompatibleClassChangeError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/IncompatibleClassChangeError] [Loaded java/lang/NoSuchFieldError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/NoSuchFieldError] [Loaded java/lang/NoSuchMethodError from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/NoSuchMethodError] [Loaded java/lang/ClassLoader from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/ClassLoader] [Loaded java/lang/SecurityManager from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/SecurityManager] [Loaded java/lang/ClassLoader$StaticData from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/ClassLoader$StaticData] [Loaded java/lang/VMClassLoader from /usr/local/jamvm/share/jamvm/classes.zip] [Linking class java/lang/VMClassLoader] [Loaded java/util/Map from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Map] [Loaded java/util/AbstractMap from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/AbstractMap] [Loaded java/util/HashMap from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/HashMap] [Loaded java/util/Map$Entry from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Map$Entry] [Loaded java/util/AbstractMap$BasicMapEntry from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/AbstractMap$BasicMapEntry] [Loaded java/util/HashMap$HashEntry from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/HashMap$HashEntry] [Created array class [Ljava/util/HashMap$HashEntry;] [Dynamic-linking native method java.lang.VMClassLoader.getBootClassPathSize ... internal] [Dynamic-linking native method java.lang.VMClassLoader.getBootClassPathResource ... internal] [Created array class [Ljava/lang/String;] [Loaded gnu/classpath/SystemProperties from /usr/local/classpath/share/classpath/glibj.zip] [Linking class gnu/classpath/SystemProperties] [Loaded java/util/Dictionary from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Dictionary] [Loaded java/util/Hashtable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Hashtable] [Loaded java/util/Properties from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Properties] [Loaded java/util/Hashtable$HashEntry from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Hashtable$HashEntry] [Created array class [Ljava/util/Hashtable$HashEntry;] [Loaded gnu/classpath/VMSystemProperties from /usr/local/jamvm/share/jamvm/classes.zip] [Linking class gnu/classpath/VMSystemProperties] [Dynamic-linking native method gnu.classpath.VMSystemProperties.preInit ... internal] [Loaded java/util/Comparator from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Comparator] [Loaded java/lang/String$CaseInsensitiveComparator from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/String$CaseInsensitiveComparator] [Loaded java/lang/StringBuffer from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/StringBuffer] [Loaded java/lang/VMSystem from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/VMSystem] [Dynamic-linking native method java.lang.VMSystem.arraycopy ... internal] [Dynamic-linking native method gnu.classpath.VMSystemProperties.postInit ... internal] [Loaded java/lang/VMObject from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/VMObject] [Dynamic-linking native method java.lang.VMObject.clone ... internal] [Loaded java/util/Set from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Set] [Loaded java/util/AbstractSet from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/AbstractSet] [Loaded java/util/Hashtable$4 from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Hashtable$4] [Loaded java/util/Collections$SynchronizedCollection from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Collections$SynchronizedCollection] [Loaded java/util/Collections$SynchronizedSet from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Collections$SynchronizedSet] [Loaded java/util/Iterator from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Iterator] [Loaded java/util/Collections$SynchronizedIterator from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Collections$SynchronizedIterator] [Loaded java/util/Hashtable$EntryIterator from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Hashtable$EntryIterator] [Loaded java/util/Enumeration from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/Enumeration] [Loaded java/util/StringTokenizer from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/StringTokenizer] [Loaded java/io/File from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/File] [Loaded java/util/ArrayList from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/util/ArrayList] [Loaded java/io/VMFile from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/VMFile] [Loaded java/lang/System from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/lang/System] [Loaded java/io/Closeable from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/Closeable] [Loaded java/io/InputStream from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/InputStream] [Loaded java/io/FilterInputStream from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/FilterInputStream] [Loaded java/io/BufferedInputStream from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/BufferedInputStream] [Loaded java/io/FileInputStream from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/FileInputStream] [Loaded java/io/FileDescriptor from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/io/FileDescriptor] [Loaded java/nio/channels/Channel from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/channels/Channel] [Loaded java/nio/channels/ReadableByteChannel from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/channels/ReadableByteChannel] [Loaded java/nio/channels/WritableByteChannel from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/channels/WritableByteChannel] [Loaded java/nio/channels/ByteChannel from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/channels/ByteChannel] [Loaded java/nio/channels/GatheringByteChannel from /usr/local/classpath/share/classpath/glibj.zip] [Linking class java/nio/channels/GatheringByteChannel] [Loaded java/nio/channels/ScatteringByteChannel from /usr/local/classpath/shar