Weird segmentation fault

Geert Bevin gbevin@uwyn.com
Fri Apr 18 13:25:00 GMT 2003


Hi,

I'm trying to integrate java with c++ using cni and I get the following 
weird segmentation fault. I'm probably doing something wong but I can't 
find what.

I've attached the 2 files that I'm using. I compile this as follows :

gcj -c Dispatcher.java
gcj -C Dispatcher.java
gcjh Dispatcher
g++ -I. -c main.cc
gcc -o main *.o -lgcj

Then I execute with

./main

and immediately get a segmentation fault.

Does someone knows why?

These are the details about my environment :

Gentoo Base System version 1.4.3.5
gbevin@pine callbacks $ uname -a
Linux pine 2.4.20-ben10 #1 Sat Apr 12 11:56:17 CEST 2003 ppc  7455, 
altivec supported GNU/Linux
gbevin@pine callbacks $ gcj -v
Reading specs from 
/opt/gcc-3.3-cvs/lib/gcc-lib/powerpc-unknown-linux-gnu/3.3/specs
Reading specs from 
/opt/gcc-3.3-cvs/lib/gcc-lib/powerpc-unknown-linux-gnu/3.3/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../configure --prefix=/opt/gcc-3.3-cvs 
--enable-threads=posix --enable-shared : (reconfigured) ../configure 
--prefix=/opt/gcc-3.3-cvs --enable-threads=posix --enable-shared 
--enable-languages=c++,java
Thread model: posix
gcc version 3.3 20030412 (prerelease)
gbevin@pine callbacks $ echo $CLASSPATH
/opt/gcc-3.3-cvs/share/java/libgcj-3.3.jar:.
gbevin@pine callbacks $ ldd --version
ldd (GNU libc) 2.3.2

This is what main is linked against :

gbevin@pine callbacks $ ldd main
         libgcj.so.4 => /opt/gcc-3.3-cvs/lib/libgcj.so.4 (0x0f74c000)
         libc.so.6 => /lib/libc.so.6 (0x0f5f1000)
         libpthread.so.0 => /lib/libpthread.so.0 (0x0f580000)
         libdl.so.2 => /lib/libdl.so.2 (0x0f55d000)
         libgcc_s.so.1 => /opt/gcc-3.3-cvs/lib/libgcc_s.so.1 (0x0f531000)
         /lib/ld.so.1 => /lib/ld.so.1 (0x30000000)

This is what gdb gives me :

gbevin@pine callbacks $ gdb ./main
GNU gdb 5.3
This GDB was configured as "powerpc-unknown-linux-gnu"...
(gdb) run
Starting program: /data/Workspace/bagheera/design/poc/callbacks/main
[New Thread 16384 (LWP 2283)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2283)]
_Jv_equalUtf8Consts(_Jv_Utf8Const*, _Jv_Utf8Const*) (a=0x0, b=0xfd95560)
     at ../../../libjava/prims.cc:146
146     ../../../libjava/prims.cc: No such file or directory.
         in ../../../libjava/prims.cc
Current language:  auto; currently c++
(gdb)


Thanks for the help,

Geert Bevin

-- 
Geert Bevin                       Uwyn
"Use what you need"               Lambermontlaan 148
http://www.uwyn.com               1030 Brussels
gbevin[remove] at uwyn dot com    Tel & Fax +32 2 245 41 06

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Dispatcher.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030418/e3e940ab/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.cc
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030418/e3e940ab/attachment.cc>


More information about the Java mailing list