FreeBSD/i386 problem

NAKATA Maho chat95@mac.com
Sun Jul 24 05:44:00 GMT 2005


Dear lists,
I'm interested in using gcj with FreeBSD 5.4-RELEASE but
unfortunately, this small test program fails,
with gcc-4.1-20050716, configured like:
% /work/gcc41/bin/gcj -v
Using built-in specs.
Reading specs from /work/gcc41/lib/gcc/i386-unknown-freebsd5.4/4.1.0/../../../libgcj.spec
rename spec lib to liborig
Target: i386-unknown-freebsd5.4
Configured with: ../configure --enable-java-awt=xlib,gtk --prefix=/work/gcc41
Thread model: posix
gcc version 4.1.0 20050716 (experimental)

% cat ClassLoaderTest.java
import java.net.*;

public class ClassLoaderTest {
    public static void main(String[] args) throws Exception {
        URL[] bootPath = new URL[1];
        bootPath[0] = new URL("file:/usr/X11R6/lib/mozilla/chrome/JP.jar");
                URLClassLoader loader = new StartupClassLoader(bootPath, null);
                Class clazz = loader.loadClass("Test");
    }
}

class StartupClassLoader extends URLClassLoader {
    public StartupClassLoader(URL[] urls, ClassLoader parent) {
        super(urls, parent);
    }
}

% setenv LD_LIBRARY_PATH /work/gcc41/lib
% /work/gcc41/bin/gcj -o foo --main=ClassLoaderTest ClassLoaderTest.java
% ./foo
Abort (core dumped)
% gdb foo foo.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Core was generated by `foo'.
Program terminated with signal 6, Aborted.
Reading symbols from /work/gcc41/lib/libgcc_s.so.1...done.
Loaded symbols for /work/gcc41/lib/libgcc_s.so.1
Reading symbols from /work/gcc41/lib/libgcj.so.7...done.
Loaded symbols for /work/gcc41/lib/libgcj.so.7
Reading symbols from /lib/libm.so.3...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /usr/lib/libpthread.so.1...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from /lib/libc.so.5...done.
Loaded symbols for /lib/libc.so.5
Reading symbols from /usr/libexec/ld-elf.so.1...done.
Loaded symbols for /usr/libexec/ld-elf.so.1
#0  0x292dd31b in pthread_testcancel () from /usr/lib/libpthread.so.1
(gdb) bt
#0  0x292dd31b in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x292ce145 in sigaction () from /usr/lib/libpthread.so.1
#2  0x292c81dd in pthread_kill () from /usr/lib/libpthread.so.1
#3  0x292c7bac in raise () from /usr/lib/libpthread.so.1
#4  0x29398c1b in abort () from /lib/libc.so.5
#5  0x286f7684 in _Jv_Throw (value=0x80a3330) at ../../../libjava/exception.cc:111
#6  0x2890a22b in java.net.URLClassLoader.findClass(java.lang.String) (this=0x0,
    className=0x80a3408) at URLClassLoader.java:1011
#7  0x29269f74 in __JCR_END__ () from /work/gcc41/lib/libgcj.so.7
#8  0x00000000 in ?? ()
#9  0x080a3408 in ?? ()
#10 0x080b6fc0 in ?? ()
#11 0x288d3a60 in java.lang.ClassLoader.loadClass(java.lang.String, boolean) (
    this=0xbfe5e8, name=0x0, resolve=8) at ClassLoader.java:317
Previous frame inner to this frame (corrupt stack?)
(gdb)

Using GNU/Linux, correct out put might be:

% ./foo
Exception in thread "main" java.lang.ClassNotFoundException: Test not found in StartupClassLoader{urls=[file:/usr/X11R6/lib/mozilla/chrome/JP.jar], parent=null}   at java.net.URLClassLoader.findClass (URLClassLoader.java:1011)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:317)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:260)
   at ClassLoaderTest.main (foo)
 
so exception is not correctly thrown for FreeBSD. 
Any hints are extremely appreciated!
-- NAKATA, Maho (maho@FreeBSD.org)



More information about the Java mailing list