From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25731 invoked by alias); 6 Oct 2010 17:07:05 -0000 Received: (qmail 25722 invoked by uid 22791); 6 Oct 2010 17:07:04 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_FJ,TW_GC,TW_LG,TW_LR,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail3.caviumnetworks.com (HELO mail3.caviumnetworks.com) (12.108.191.235) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Oct 2010 17:06:59 +0000 Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,7,2,8378) id ; Wed, 06 Oct 2010 10:07:32 -0700 Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Oct 2010 10:07:05 -0700 Received: from dd1.caveonetworks.com ([12.108.191.236]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Oct 2010 10:07:05 -0700 Message-ID: <4CACACB1.10300@caviumnetworks.com> Date: Wed, 06 Oct 2010 17:07:00 -0000 From: David Daney User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100907 Fedora/3.0.7-1.fc12 Thunderbird/3.0.7 MIME-Version: 1.0 To: Andreas Frisch CC: java@gcc.gnu.org Subject: Re: gcj static crosscompiling raises issues with boehm-gc References: <20101006165317.6FCC531488CA@mail.multimedia-labs.de> In-Reply-To: <20101006165317.6FCC531488CA@mail.multimedia-labs.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: 2010-10/txt/msg00006.txt.bz2 On 10/06/2010 09:53 AM, Andreas Frisch wrote: > Am Mittwoch, 6. Oktober 2010, um 08:51:40 schrieb David Daney: >> On 10/06/2010 07:25 AM, Andrew Haley wrote: >>> On 10/06/2010 09:43 AM, Andreas Frisch wrote: >>>> hi gcj experts, >>>> >>>> i've spent some time already trying to statically cross compile a java >>>> source for an embedded mipsel architecture. i'm using openembedded >>>> and gcc-4.4.4 with the latest java part imported from master >>>> >>>> in the makefile, i am using the command >>>> >>>> $(CROSS_COMPILE)gcj $(JFLAGS) $(SOURCES) \ >>>> >>>> -static-libgcj \ >>>> -fjni \ >>>> -g \ >>>> -o dumphd-mipsel-static \ >>>> >>>> --main=dumphd.core.DumpHD \ >>>> >>>> -nostdlib \ >>>> -L/dream/oe1.6/dm8000/build/tmp/staging/mipsel-oe-linux/usr/lib > \ >>>> -L/dream/projects/bluray/aacskeys-0.4.0c-mipsel/lib/linux/ \ >>>> -Wl,-rpath-link,/dream/oe1.6/dm8000/build/tmp/staging/mipsel-oe- >>>> >>>> linux/usr/lib \ >>>> >>>> -Wl,-rpath-link,/dream/projects/bluray/aacskeys-0.4.0c- >>>> >>>> mipsel/lib/linux/ -laacskeys \ >>>> >>>> -shared-libgcc -Wl,-non_shared -lgcj -Wl,-call_shared -lstdc++ - >>>> >>>> Wl,--as-needed -lgcc_s -lpthread -lc -lm -ldl -lrt -Wl,--no-as-needed >>>> -Wl,-O1 >>>> >>>> this may contain a lot of redundancies or look silly in many ways but >>>> for right now i just aggregated as much as possible in there from >>>> what i could find online. >>>> >>>> i've also set >>>> CLASSPATH=/dream/oe1.6/dm8000/build/tmp/cross/mipsel/bin/ecj.jar:./ >>>> >>>> when i run make, linking fails: >>>> >>>> /dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe- >>>> linux/4.4.4/../../../../mipsel-oe-linux/bin/ld: warning: cannot find >>>> entry symbol __start; defaulting to 00000000004084b0 >>>> /dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe- >>>> linux/4.4.4/../../../../mipsel-oe-linux/lib/libgcj.a(dyn_load.o): In >>>> function `GC_register_dynamic_libraries_dl_iterate_phdr': >>>> /dream/oe1.6/dm8000/build/tmp/work/mipsel-oe-linux/gcc-cross-4.4.4- >>>> r0.1/gcc-4.4.4/boehm-gc/dyn_load.c:454: undefined reference to >>>> `__data_start' >>>> /dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe- >>>> linux/4.4.4/../../../../mipsel-oe-linux/lib/libgcj.a(os_dep.o): In >>>> function `GC_register_data_segments': >>>> /dream/oe1.6/dm8000/build/tmp/work/mipsel-oe-linux/gcc-cross-4.4.4- >>>> r0.1/gcc-4.4.4/boehm-gc/os_dep.c:1450: undefined reference to >>>> `__data_start' collect2: ld returned 1 exit status >>>> make: *** [dumphd-static-new] Error 1 >>>> >>>> i'd be grateful for any suggestions or hints. >>> >>> This looks completely broken: it seems to be trying to statically link >>> against libgcj. Try it without -non_shared. >> >> To expound on this, the '-static-libgcj' option was created so that all >> the other things you have there would be unneeded. >> >> I doubt you want any of: -shared-libgcc -Wl,-non_shared -lgcj >> -Wl,-call_shared -lstdc++ -Wl,--as-needed -lgcc_s -lpthread -lc -lm -ldl >> -lrt -Wl,--no-as-needed -Wl,-O1 >> >> >> Start off with -static-libgcj on a very simple 'hello-world' type >> program. Then start adding all your other things in. >> >> David Daney > > hi david! > > actually i was already successful statically cross compiling java programs as > complex as projectx: > > it works both the traditional way > projectx-static-oldfashioned: $(OBJS) > $(CROSS_COMPILE)gcj $(JFLAGS) -c -o ac3.o --resource ac3.bin > ../resources/ac3.bin > $(CROSS_COMPILE)gcj $(JFLAGS) -c -o pjxresources_en.o --resource > pjxresources_en.properties ../resources/pjxresources_en.properties > $(CROSS_COMPILE)gcj $(JFLAGS) $(OBJS) pjxresources_en.o ac3.o - > Djava.awt.headless=true --main=net.sourceforge.dvb.projectx.common.Start - > save-temps > $(CROSS_COMPILE)gcc -o projectx $(OBJS) pjxresources_en.o ac3.o > ./net.sourceforge.dvb.projectx.common.Startmain.i \ > -shared-libgcc -Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as- > needed -lgcc_s -lpthread -lc -lm -ldl -lrt -Wl,--no-as-needed > $(CROSS_COMPILE)strip --strip-all projectx > > and with the new nifty -static-libgcj convenience parameter > projectx-static: > $(CROSS_COMPILE)gcj $(JFLAGS) -c -o ac3.o --resource ac3.bin > ../resources/ac3.bin > $(CROSS_COMPILE)gcj $(JFLAGS) -c -o pjxresources_en.o --resource > pjxresources_en.properties ../resources/pjxresources_en.properties > $(CROSS_COMPILE)gcj -static-libgcj -o projectx $(SOURCES) > pjxresources_en.o ac3.o \ > -Djava.awt.headless=true --main=net.sourceforge.dvb.projectx.common.Start > $(CROSS_COMPILE)strip --strip-all projectx > > however, what's different about this new program is that it requires that c++ > compiled shared object libaacskeys.so and that's what causes my problems i > guess > Things can get complicated when linking in C++ code with the gcj driver program. I would think all you would need is -lsupc++, and perhaps -lstdc++. -nostdlib looks a bit questionable to me. In any event it is good to see that people are still making use of gcj on mips. David Daney