This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: trouble compiling app w/ jni
- To: green at redhat dot com
- Subject: RE: trouble compiling app w/ jni
- From: stewart at neuron dot com
- Date: Sat, 14 Apr 2001 11:58:13 -0500 (CDT)
- Cc: stewart at neuron dot com, java at gcc dot gnu dot org
- References: <NEBBKJDPKLNNENPPIHCPCEODKPAA.green@redhat.com>
thanks. it now compiles. running it, however just says "Aborted" and quits.
the first tree lines of main() print the command line args so it's not even
getting that far. under gdb I get this:
Starting program: /local/uml/opt/sys/foo
[New Thread 1024 (LWP 14550)]
[New Thread 2049 (LWP 14551)]
[New Thread 1026 (LWP 14552)]
Program received signal SIGABRT, Aborted.
[Switching to Thread 1026 (LWP 14552)]
0x4036ffe1 in __kill () from /lib/libc.so.6
(gdb) bt
#0 0x4036ffe1 in __kill () from /lib/libc.so.6
#1 0x40324ceb in raise (sig=6) at signals.c:65
#2 0x40371582 in abort () at ../sysdeps/generic/abort.c:88
#3 0x804a31b in __default_terminate () at ../../gcc/libgcc2.c:3034
#4 0x804a33a in __terminate () at ../../gcc/libgcc2.c:3034
#5 0x804b08a in throw_helper (eh=0x8094bb0, pc=0x402d327f,
my_udata=0xbf7ff888, offset_p=0xbf7ff884) at ../../gcc/libgcc2.c:3168
#6 0x804b33f in __rethrow (index=0x402d3280) at ../../gcc/libgcc2.c:3168
#7 0x401d2d22 in java::lang::Class::initializeClass (this=0x8050c20) at
../../../libjava/java/lang/natClass.cc:762
#8 0x402d3280 in .LRTH348 () from /usr/lib/libgcj.so.1
#9 0x5b000000 in ?? ()
Cannot access memory at address 0xe8f689
I'm not well versed in gdb. How do I track the reason for the class failing
to initialize?
stewart
> Stewart wrote:
>> and the LD_LIBRARY_PATH is set correctly. foo.class is dependent on
>> syscall.class which contains native methods and uses libsyscall.so
>> (sucessfully compiled).
>
> You need to compile syscall.class with -fjni. The documentation says:
> "With gcj there are two options for writing native methods: CNI and
> JNI. By default gcj assumes you are using CNI. If you are compiling a
> class with native methods, and these methods are implemented using JNI,
> then you must use -fjni. This option causes gcj to generate stubs which
> will invoke the underlying JNI methods."
>
> AG