gcj: hello world crash

Henry Miller hmiller@intradyn.com
Mon Apr 4 15:43:00 GMT 2005


I've install gcj along with the rest of gcc34 on my FreeBSD 5.3 system
(Installed from the ports system, updated today), and built and ran a
simple hello world program.  Surprisingly it dumps core, failing in
_Jv_FindClass  (gdb output follows).  Obviously something isn't
installed right, but what?


%gcj34 -v
Reading specs from
/usr/local/lib/gcc/i386-portbld-freebsd5.3/3.4.4/specs
Reading specs from
/usr/local/lib/gcc/i386-portbld-freebsd5.3/3.4.4/libgcj.spec
rename spec lib to liborig
Configured with: ./..//gcc-3.4-20050401/configure --disable-nls
--with-system-zlib --with-libiconv-prefix=/usr/local
--program-suffix=34
--with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.3/3.4.4/
include/c++/ --disable-shared --prefix=/usr/local
i386-portbld-freebsd5.3
Thread model: posix
gcc version 3.4.4 20050401 (prerelease) [FreeBSD]

(This same problem happens with a February snapshot as well)

%cat Hello.java

class Hello
{
        public static final void main(String[] args)
        {
                System.out.println("Hello world");
        }
}

%gcj34 -c -g -O Hello.java
%gcj34 --main=Hello -o Hello Hello.o
%./Hello
Segmentation fault (core dumped)
%gdb Hello Hello.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 `Hello'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libm.so.3...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /usr/lib/libc_r.so.5...done.
Loaded symbols for /usr/lib/libc_r.so.5
Reading symbols from /lib/libz.so.2...done.
Loaded symbols for /lib/libz.so.2
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  0x080748bc in _Jv_FindClass ()
(gdb) bt
#0  0x080748bc in _Jv_FindClass ()
#1  0x08071270 in java::lang::Class::forName ()
#2  0x0807132b in java::lang::Class::forName ()
#3  0x080b1d58 in gnu.gcj.convert.UnicodeToBytes.getDefaultEncoder() ()
    at
../.././..//gcc-3.4-20050401/libjava/gnu/gcj/convert/UnicodeToBytes.jav
a:49
#4  0x0808cb54 in java.io.PrintStream.PrintStream(java.io.OutputStream,
boolean) (this=0x82dff90, out=0x82dbab0, auto_flush=true)
    at
../.././..//gcc-3.4-20050401/libjava/java/io/PrintStream.java:118
#5  0x0808533f in java.lang.System.<clinit>() ()
    at ../.././..//gcc-3.4-20050401/libjava/java/lang/System.java:146
#6  0x08072587 in java::lang::Class::initializeClass ()
#7  0x08073faa in _Jv_InitClass ()
#8  0x080856e7 in java.lang.System.getProperty(java.lang.String) (
    key=0x82bff00)
    at ../.././..//gcc-3.4-20050401/libjava/java/lang/System.java:405
#9  0x08087eb1 in java.lang.VMClassLoader.getSystemClassLoader() ()
    at
../.././..//gcc-3.4-20050401/libjava/java/lang/VMClassLoader.java:280
#10 0x0807e47e in java.lang.ClassLoader.<clinit>() ()
    at
../.././..//gcc-3.4-20050401/libjava/java/lang/ClassLoader.java:156
#11 0x08072587 in java::lang::Class::initializeClass ()
#12 0x0804c128 in _Jv_CreateJavaVM ()
#13 0x0804c207 in _Jv_RunMain ()
---Type <return> to continue, or q <return> to quit---
#14 0x0804c35c in JvRunMain ()
#15 0x0804ad6d in main ()
(gdb)





More information about the Gcc-help mailing list