This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Weird segmentation fault
- From: Geert Bevin <gbevin at uwyn dot com>
- To: java at gcc dot gnu dot org
- Date: Fri, 18 Apr 2003 14:19:57 +0200
- Subject: Weird segmentation fault
- Organization: UWYN
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 at 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 at 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 at pine callbacks $ echo $CLASSPATH
/opt/gcc-3.3-cvs/share/java/libgcj-3.3.jar:.
gbevin at pine callbacks $ ldd --version
ldd (GNU libc) 2.3.2
This is what main is linked against :
gbevin at 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 at 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
public class Dispatcher
{
private static Dispatcher sInstance = new Dispatcher();
private Dispatcher()
{
}
public static Dispatcher getInstance()
{
return sInstance;
}
}
#include <Dispatcher.h>
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
Dispatcher::getInstance();
return 0;
}