public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* linking libgcj.a
@ 2009-06-04 10:43 abhishek desai
  2009-06-04 11:05 ` Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: abhishek desai @ 2009-06-04 10:43 UTC (permalink / raw)
  To: java

Hi,

I have a program mytest.c which is calling JNI_CreateJavaVM. I am
using gcc 3.4.6. During my compilation I am adding the libgcj.a
library to the compilation because I want the libgcj.a to be a part of
the main application. I am using the below command to compile.

gcc mytest.c libgcj.a -o mytest -ldl -lm -lpthread

This compiles correctly but the application crashes and I get a
coredump as below.

#0  0x0053b020 in GC_FirstDLOpenedLinkMap () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/dyn_load.c:486
#1  0x0053b0d4 in GC_register_dynamic_libraries () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/dyn_load.c:506
#2  0x00537478 in GC_cond_register_dynamic_libraries () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/mark_rts.c:553
#3  0x00537fe0 in GC_stopped_mark (stop_func=0x537b00 <GC_never_stop_func>)
    at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/alloc.c:479
#4  0x00539014 in GC_try_to_collect_inner (stop_func=0x537b00
<GC_never_stop_func>)
    at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/alloc.c:364
#5  0x0053c1e0 in GC_init_inner () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/misc.c:758
#6  0x0053c3f8 in GC_init () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/misc.c:477
#7  0x0052d59c in GC_init_gcj_malloc (mp_index=0, mp=0x52ab30) at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/gcj_mlc.c:60
#8  0x0052be98 in _Jv_InitGC () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/boehm.cc:526
#9  0x00548310 in _Jv_CreateJavaVM () at
/root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/prims.cc:907
#10 0x004a39d0 in JNI_CreateJavaVM (vm=0x7ff8acfc, penv=0x7ff8acf8, args=0x0)
    at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/jni.cc:2422
#11 0x0049f820 in start ()
#12 0x0049fa38 in main ()

This works fine if the libgcj is loaded as a shared library. Can I not
link the libgcj.a into the application while compiling ?

Abhishek

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: linking libgcj.a
  2009-06-04 10:43 linking libgcj.a abhishek desai
@ 2009-06-04 11:05 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2009-06-04 11:05 UTC (permalink / raw)
  To: abhishek desai; +Cc: java

abhishek desai wrote:

> I have a program mytest.c which is calling JNI_CreateJavaVM. I am
> using gcc 3.4.6. During my compilation I am adding the libgcj.a
> library to the compilation because I want the libgcj.a to be a part of
> the main application. I am using the below command to compile.
> 
> gcc mytest.c libgcj.a -o mytest -ldl -lm -lpthread
> 
> This compiles correctly but the application crashes and I get a
> coredump as below.
> 
> #0  0x0053b020 in GC_FirstDLOpenedLinkMap () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/dyn_load.c:486
> #1  0x0053b0d4 in GC_register_dynamic_libraries () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/dyn_load.c:506
> #2  0x00537478 in GC_cond_register_dynamic_libraries () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/mark_rts.c:553
> #3  0x00537fe0 in GC_stopped_mark (stop_func=0x537b00 <GC_never_stop_func>)
>     at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/alloc.c:479
> #4  0x00539014 in GC_try_to_collect_inner (stop_func=0x537b00
> <GC_never_stop_func>)
>     at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/alloc.c:364
> #5  0x0053c1e0 in GC_init_inner () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/misc.c:758
> #6  0x0053c3f8 in GC_init () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/misc.c:477
> #7  0x0052d59c in GC_init_gcj_malloc (mp_index=0, mp=0x52ab30) at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/boehm-gc/gcj_mlc.c:60
> #8  0x0052be98 in _Jv_InitGC () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/boehm.cc:526
> #9  0x00548310 in _Jv_CreateJavaVM () at
> /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/prims.cc:907
> #10 0x004a39d0 in JNI_CreateJavaVM (vm=0x7ff8acfc, penv=0x7ff8acf8, args=0x0)
>     at /root/mipsel/buildroot-2009.02/toolchain_build_mipsel/gcc-3.4.6/libjava/jni.cc:2422
> #11 0x0049f820 in start ()
> #12 0x0049fa38 in main ()
> 
> This works fine if the libgcj is loaded as a shared library. Can I not
> link the libgcj.a into the application while compiling ?

Maybe, but you're just going to have to debug it.  It's not clear
to me what's going wrong.  Statically linking with libgcj is always
tricky,and you're using very old code.

Andrew.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-04 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-04 10:43 linking libgcj.a abhishek desai
2009-06-04 11:05 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).