Problems in GCJ

Deepak jdeepak@indiainfo.com
Wed Jan 30 20:10:00 GMT 2002


  
hi ,
  
     
  presently i am working in solaris 8.i tried to convert my  java code 
into native code.
Using GCJ ( from GNU) i tried to compile my java code and i got a 
executable.
this GCJ version is 2.95.while running the executable ,it dumped 
core(segmentation fault)
  
here is the code and trace
  
public class HelloWorld
{
      public static void main( String arg[])
      {
           System.out.println("HelloWorld");
       }
  }
  
and the trace is ....
  
-------------------------------------------------------
test-05:/home/test/Java%> ls
HelloWorld       HelloWorld.java
test-05:/home/test/Java%>gcj --main=HelloWorld -o HelloWorld 
HelloWorld.java
test-05:/home/test/Java%> ./HelloWorld
Segmentation Fault (core dumped)
ipgen-05:/home/test/Java%> gdb HelloWorld core
GNU gdb 5.0
Copyright 2000 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 "sparc-sun-solaris2.8"...
Core was generated by `./HelloWorld'.
Program terminated with signal 11, Segmentation Fault.
Reading symbols from /usr/local/lib/libgcj.so.0...done.
Loaded symbols for /usr/local/lib/libgcj.so.0
Reading symbols from /lib/libm.so.1...done.
Loaded symbols for /lib/libm.so.1
Reading symbols from /usr/local/lib/libgcjgc.so.0...done.
Loaded symbols for /usr/local/lib/libgcjgc.so.0
Reading symbols from /usr/local/lib/libzgcj.so.0...done.
Loaded symbols for /usr/local/lib/libzgcj.so.0
Reading symbols from /lib/libsocket.so.1...done.
Loaded symbols for /lib/libsocket.so.1
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.1...done.
Loaded symbols for /lib/libdl.so.1
Reading symbols from /lib/libc.so.1...done.
Loaded symbols for /lib/libc.so.1
Reading symbols from /lib/libmp.so.2...done.
Loaded symbols for /lib/libmp.so.2
Reading symbols from
/usr/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1...done.
Loaded symbols for /usr/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1
#0  _Jv_equalUtf8Consts (a=0x0, b=0xff2d4442) at
../../../libjava/prims.cc:89
89      ../../../libjava/prims.cc: No such file or directory.
(gdb) bt
#0  _Jv_equalUtf8Consts (a=0x0, b=0xff2d4442) at
../../../libjava/prims.cc:89
#1  0xff2a6b5c in _Jv_GetMethodLocal (klass=0xff31f7fc, name=0x0,
     signature=0x0) at ../../../libjava/java/lang/natClass.cc:527
#2  0xff2a6918 in java::lang::Class::hackRunInitializers
(this=0xff31f7fc)
     at ../../../libjava/java/lang/natClass.cc:416
#3  0xff2a3d58 in java.lang.Class.hackTrampoline (this=0xff31f7fc,
what=1,
     old_exception=0x0) at ../../../libjava/java/lang/Class.java:137
#4  0xff2a6aa8 in java::lang::Class::initializeClass (this=0xff31f7fc)
     at ../../../libjava/java/lang/natClass.cc:489
#5  0xff2a3d30 in java.lang.Class.hackTrampoline (this=0xff31f7fc,
what=0,
     old_exception=0x0) at ../../../libjava/java/lang/Class.java:135
#6  0xff2a6a64 in java::lang::Class::initializeClass (this=0xff313990)
     at ../../../libjava/java/lang/natClass.cc:475
#7  0xff2a6ce8 in _Jv_InitClass (klass=0xff313990)
     at ../../../libjava/java/lang/natClass.cc:565
#8  0xff22fab0 in _Jv_AllocObject (c=0xff313990, size=32)
     at ../../../libjava/prims.cc:266
#9  0xff2a955c in _Jv_AllocString (len=6) at
../../../libjava/include/cni.h:31
#10 0xff2a93bc in _Jv_NewStringUtf8Const (str=0x0)
     at ../../../libjava/java/lang/natString.cc:226
#11 0xff2a6850 in java::lang::Class::resolveConstants
(this=0xff313990)
     at ../../../libjava/java/lang/natClass.cc:392
#12 0xff2a697c in java::lang::Class::initializeClass (this=0xff313990)
---Type <return> to continue, or q <return> to quit---
     at ../../../libjava/java/lang/natClass.cc:440
#13 0xff2a6ce8 in _Jv_InitClass (klass=0xff313990)
     at ../../../libjava/java/lang/natClass.cc:565
#14 0xff22fab0 in _Jv_AllocObject (c=0xff313990, size=24)
     at ../../../libjava/prims.cc:266
#15 0xff2a955c in _Jv_AllocString (len=2) at
../../../libjava/include/cni.h:31
#16 0xff2a93bc in _Jv_NewStringUtf8Const (str=0x0)
     at ../../../libjava/java/lang/natString.cc:226
#17 0xff2a6850 in java::lang::Class::resolveConstants
(this=0xff31488c)
     at ../../../libjava/java/lang/natClass.cc:392
#18 0xff2a697c in java::lang::Class::initializeClass (this=0xff31488c)
     at ../../../libjava/java/lang/natClass.cc:440
#19 0xff2a3d30 in java.lang.Class.hackTrampoline (this=0xff31488c,
what=0,
     old_exception=0x0) at ../../../libjava/java/lang/Class.java:135
#20 0xff2a6a64 in java::lang::Class::initializeClass (this=0xff31106c)
     at ../../../libjava/java/lang/natClass.cc:475
#21 0xff2a3d30 in java.lang.Class.hackTrampoline (this=0xff31106c,
what=0,
     old_exception=0x0) at ../../../libjava/java/lang/Class.java:135
#22 0xff2a6a64 in java::lang::Class::initializeClass (this=0xff312eb0)
     at ../../../libjava/java/lang/natClass.cc:475
#23 0xff2a3d30 in java.lang.Class.hackTrampoline (this=0xff312eb0,
what=0,
     old_exception=0x0) at ../../../libjava/java/lang/Class.java:135
#24 0xff2a6a64 in java::lang::Class::initializeClass (this=0xff3128d4)
---Type <return> to continue, or q <return> to quit---
     at ../../../libjava/java/lang/natClass.cc:475
#25 0xff2a6ce8 in _Jv_InitClass (klass=0xff3128d4)
     at ../../../libjava/java/lang/natClass.cc:565
#26 0xff22fab0 in _Jv_AllocObject (c=0xff3128d4, size=12)
     at ../../../libjava/prims.cc:266
#27 0xff230298 in JvRunMain (klass=0x277c4, argc=1, argv=0xffbef9b4)
     at ../../../libjava/prims.cc:576
#28 0x129b4 in main (argc=1, argv=0xffbef9b4)
Current language:  auto; currently c++
(gdb)
------------------------------------------------
  
then i contacted Mr.Bryce  at bryce@sourceware.cygnus.com
he suggested me to use the latest Gcc compiler.(i.e) 3.0.3 which has a 
built in GCJ
i tried the same code using GCJ 3.0.3 ,it compiled correctly. i got 
some linking errors
saying that libiconv?? missing.i tried downloading that library.after 
that i am getting this 
encoding Problem.
  
Here is the trace.....
  
--------
gcj --main=HelloWorld -o HelloWorld HelloWorld.java
HelloWorld.java:0: unknown encoding: `ISO8859-1'
    This might mean that your locale's encoding is not supported
    by your system's iconv(3) implementation.  If you aren't trying
    to use a particular encoding for your input file, try the
    `--encoding=UTF-8' option.
compilation terminated
-------------
  
i hope you willl help me in solving this problem.
  
thanks,
Deepak
---------------------------------------------
http://mail.indiainfo.com
India's first ISO certified portal
Check world time at http://time.indiainfo.com



More information about the Java mailing list