From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10075 invoked by alias); 4 Jun 2009 11:05:01 -0000 Received: (qmail 10060 invoked by uid 22791); 4 Jun 2009 11:05:01 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_63,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Jun 2009 11:04:54 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n54B4qHk028182; Thu, 4 Jun 2009 07:04:52 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n54B4pCI031936; Thu, 4 Jun 2009 07:04:51 -0400 Received: from zebedee.pink (vpn-12-111.rdu.redhat.com [10.11.12.111]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n54B4nu4020417; Thu, 4 Jun 2009 07:04:50 -0400 Message-ID: <4A27AA51.4070307@redhat.com> Date: Thu, 04 Jun 2009 11:05:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: abhishek desai CC: java@gcc.gnu.org Subject: Re: linking libgcj.a References: <898285d30906040343h28652da6j8dd600bf5122754e@mail.gmail.com> In-Reply-To: <898285d30906040343h28652da6j8dd600bf5122754e@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00007.txt.bz2 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 ) > 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 > ) > 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.