public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* gcj static crosscompiling raises issues with boehm-gc
@ 2010-10-06  8:43 Andreas Frisch
  2010-10-06 14:25 ` Andrew Haley
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Frisch @ 2010-10-06  8:43 UTC (permalink / raw)
  To: java

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.

andreas

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

* Re: gcj static crosscompiling raises issues with boehm-gc
  2010-10-06  8:43 gcj static crosscompiling raises issues with boehm-gc Andreas Frisch
@ 2010-10-06 14:25 ` Andrew Haley
  2010-10-06 15:51   ` David Daney
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Haley @ 2010-10-06 14:25 UTC (permalink / raw)
  To: java

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.

Andrew.

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

* Re: gcj static crosscompiling raises issues with boehm-gc
  2010-10-06 14:25 ` Andrew Haley
@ 2010-10-06 15:51   ` David Daney
  0 siblings, 0 replies; 10+ messages in thread
From: David Daney @ 2010-10-06 15:51 UTC (permalink / raw)
  To: Andrew Haley, andreas.frisch; +Cc: java

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

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

* Re: gcj static crosscompiling raises issues with boehm-gc
  2010-10-06 18:50 Andreas Frisch
@ 2010-10-06 19:02 ` David Daney
  0 siblings, 0 replies; 10+ messages in thread
From: David Daney @ 2010-10-06 19:02 UTC (permalink / raw)
  To: Andreas Frisch; +Cc: java

On 10/06/2010 11:49 AM, Andreas Frisch wrote:
> good suggestions to come to the irc channel :)
> thanks to aph i finally found a set of parameters which produces an executable:
>
> dumphd-static:
> 	$(CROSS_COMPILE)gcj -o dumphd $(SOURCES)  --main=dumphd.core.DumpHD -
> static-libgcj \
> 	-fjni \
> 	-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 \
> 	-Wl,-lstdc++ -lsupc++

I think the '-Wl,' is not needed, gcj should just pass all '-l' things 
without adding that.

> 	$(CROSS_COMPILE)strip --strip-all dumphd
>

Other than that, It looks correct.  The only extra options you need that 
gcj does not already provide over what would be required with g++ are 
"-lstdc++ -lsupc++"

David Daney

> [OE::mipsel-oe-linux-opendreambox-dm8000]:/dream/projects/bluray/dumphd-0.61-
> mipsel$ file dumphd
> dumphd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), for GNU/Linux
> 2.6.12, dynamically linked (uses shared libs), stripped
>
> i will test and evaluate on the embedded architecture tomorrow!
>
> thanks for the quick and competent support!
>

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

* Re: gcj static crosscompiling raises issues with boehm-gc
@ 2010-10-06 18:50 Andreas Frisch
  2010-10-06 19:02 ` David Daney
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Frisch @ 2010-10-06 18:50 UTC (permalink / raw)
  To: java

good suggestions to come to the irc channel :)
thanks to aph i finally found a set of parameters which produces an executable:

dumphd-static: 
	$(CROSS_COMPILE)gcj -o dumphd $(SOURCES)  --main=dumphd.core.DumpHD -
static-libgcj \
	-fjni \
	-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 \
	-Wl,-lstdc++ -lsupc++
	$(CROSS_COMPILE)strip --strip-all dumphd

[OE::mipsel-oe-linux-opendreambox-dm8000]:/dream/projects/bluray/dumphd-0.61-
mipsel$ file dumphd
dumphd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), for GNU/Linux 
2.6.12, dynamically linked (uses shared libs), stripped

i will test and evaluate on the embedded architecture tomorrow!

thanks for the quick and competent support!

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

* Re: gcj static crosscompiling raises issues with boehm-gc
       [not found] <20101006175323.A6AC03148D76@mail.multimedia-labs.de>
@ 2010-10-06 17:58 ` David Daney
  0 siblings, 0 replies; 10+ messages in thread
From: David Daney @ 2010-10-06 17:58 UTC (permalink / raw)
  To: Andreas Frisch, Java List

Normally I leave the list CCed.  It is my personal policy not to respond 
to private messages of this nature, but I am making an exception for 
this one.

On 10/06/2010 10:53 AM, Andreas Frisch wrote:
>> 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
>
> dear David,
>
> yeah it actually comes in very handy! if it just wasn't so tricky to use.
> okay soo where do i start... i mean i've literally spent a week trying to get
> this to link properly and i've tried maaaany combinations of the parameters
>
> i'll just put in some command lines along with excerpts of the respective
> error messages
>
>   --main=dumphd.core.DumpHD -static-libgcj
>          -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 \
>          -Wl,-non_shared \
>          -Wl,-lstdc++ -lsupc++
>
> 10 problems (10 warnings)
> /dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe-
> linux/4.4.4/../../../../mipsel-oe-linux/bin/ld: cannot find -lgcc_s
>
> ***
>
>   --main=dumphd.core.DumpHD -static-libgcj \
>          -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 \
>          -Wl,-lstdc++ -lsupc++
>
> 10 problems (10 warnings)
> /dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe-
> linux/4.4.4/../../../../mipsel-oe-linux/bin/ld: warning: libgcc_s.so.1, needed
> by /dream/projects/bluray/aacskeys-0.4.0c-mipsel/lib/linux//libaacskeys.so,
> not found (try using -rpath or -rpath-link)
> /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 00000000004015d0
> /tmp/cclqdxg7.o: In function `bdvm::vm::BDVMException::BDVMException()':
> ./source/bdvm/vm/BDVMException.java:(.text+0x2c): undefined reference to
> `java::lang::Exception::Exception()'
> /tmp/cclqdxg7.o: In function
> `bdvm::vm::BDVMException::BDVMException(java::lang::String*)':
> ./source/bdvm/vm/BDVMException.java:(.text+0x8c): undefined reference to
> `java::lang::Exception::Exception(java::lang::String*)'
> /tmp/cclqdxg7.o: In function
> `bdvm::vm::BDVMException::BDVMException(java::lang::String*,
> java::lang::Throwable*)':
> ./source/bdvm/vm/BDVMException.java:(.text+0x100): undefined reference to
> `java::lang::Exception::Exception(java::lang::String*,
> java::lang::Throwable*)'
> /tmp/cclqdxg7.o: In function
> `bdvm::vm::BDVMException::BDVMException(java::lang::Throwable*)':
> ./source/bdvm/vm/BDVMException.java:(.text+0x160): undefined reference to
> `java::lang::Exception::Exception(java::lang::Throwable*)'
> /tmp/cclqdxg7.o: In function
> `dumphd::bdplus::ConversionTable::ConversionTable()':
> ./source/bdvm/vm/BDVMException.java:(.text+0x1b4): undefined reference to
> `java::lang::Object::Object()'
> ./source/bdvm/vm/BDVMException.java:(.text+0x1cc): undefined reference to
> `java::util::ArrayList::class$'
> 6000+ similar undefined refs
>
> ***
>
>   --main=dumphd.core.DumpHD -static-libgcj \
>          -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 \
>          -Wl,-lstdc++ -lsupc++
>
> 10 problems (10 warnings)
> /tmp/ccWdYPef.o:(.data+0x5638): undefined reference to `hidden alias for
> java::lang::String* dumphd::aacs::AACSKeys::getVersionString()'
> /tmp/ccWdYPef.o:(.data+0x563c): undefined reference to `hidden alias for void
> dumphd::aacs::AACSKeys::getKeys(java::lang::String*, dumphd::core::KeyData*)'
> /tmp/ccWdYPef.o:(.data+0x5680): undefined reference to `hidden alias for
> java::lang::String* dumphd::aacs::AACSKeys::getVersionString()'
> /tmp/ccWdYPef.o:(.data+0x5694): undefined reference to `hidden alias for void
> dumphd::aacs::AACSKeys::getKeys(java::lang::String*, dumphd::core::KeyData*)'
> collect2: ld returned 1 exit status
>
>
> the parameter set in my original post (with the boehm-gc errors) led me the
> farthest, as far as i can tell. at least there were no complaints about
> linking the java sources and that c++ library, possible though that it failed
> in an earlier state of the linking process - i don't really know
>
> still open for more suggestions, i am available on instant messangers or irc
> too for live trial and error experiments :)
> andy@snaut.ath.cx thorugh jabber/xmpp or fraxinas on ircnet or freenode irc

The GCJ IRC channel typically has the highest concentration of gcj 
experts available on this planet.

David Daney

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

* Re: gcj static crosscompiling raises issues with boehm-gc
  2010-10-06 16:53 Andreas Frisch
@ 2010-10-06 17:07 ` David Daney
  0 siblings, 0 replies; 10+ messages in thread
From: David Daney @ 2010-10-06 17:07 UTC (permalink / raw)
  To: Andreas Frisch; +Cc: java

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

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

* Re: gcj static crosscompiling raises issues with boehm-gc
@ 2010-10-06 16:53 Andreas Frisch
  2010-10-06 17:07 ` David Daney
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Frisch @ 2010-10-06 16:53 UTC (permalink / raw)
  To: java

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

andreas

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

* Re: gcj static crosscompiling raises issues with boehm-gc
  2010-10-06 15:45 Andreas Frisch
@ 2010-10-06 16:07 ` Andrew Haley
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Haley @ 2010-10-06 16:07 UTC (permalink / raw)
  To: Andreas Frisch; +Cc: java

On 10/06/2010 04:44 PM, Andreas Frisch wrote:
>> This looks completely broken: it seems to be trying to statically link
>> gainst libgcj.  Try it without -non_shared.
> 
> Hi Andrew, thanks for your prompt help!
> linking statically against libgcj is what i actually intend to do to save a 
> lot of space on the embedded device with very limited capacity.

That is really hard to get working.  It can be done, but you
should at least get dynamic linking working first.

> other than that, if i omit the -non_shared parameter, then it doesn't seem to 
> find the aacskeys.so which is a run-time include of in one of the java files 
> where it does a System.loadLibrary("aacskeys");

It'll be fibn as long as it's in the load path.  You might be better
using a full path to the library.

> the resulting error message is the infamous
> /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 0000000000406960

Are you forgetting to compile with -jni ?

       -fjni
           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.

Andrew.

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

* Re: gcj static crosscompiling raises issues with boehm-gc
@ 2010-10-06 15:45 Andreas Frisch
  2010-10-06 16:07 ` Andrew Haley
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Frisch @ 2010-10-06 15:45 UTC (permalink / raw)
  To: java

> This looks completely broken: it seems to be trying to statically link
> gainst libgcj.  Try it without -non_shared.
>
> Andrew.

Hi Andrew, thanks for your prompt help!
linking statically against libgcj is what i actually intend to do to save a 
lot of space on the embedded device with very limited capacity.
other than that, if i omit the -non_shared parameter, then it doesn't seem to 
find the aacskeys.so which is a run-time include of in one of the java files 
where it does a System.loadLibrary("aacskeys");

the resulting error message is the infamous
/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 0000000000406960
/tmp/cceZJsQ2.o:(.data+0x5638): undefined reference to `hidden alias for 
java::lang::String* dumphd::aacs::AACSKeys::getVersionString()'
/tmp/cceZJsQ2.o:(.data+0x563c): undefined reference to `hidden alias for void 
dumphd::aacs::AACSKeys::getKeys(java::lang::String*, dumphd::core::KeyData*)'
/tmp/cceZJsQ2.o:(.data+0x5680): undefined reference to `hidden alias for 
java::lang::String* dumphd::aacs::AACSKeys::getVersionString()'
/tmp/cceZJsQ2.o:(.data+0x5694): undefined reference to `hidden alias for void 
dumphd::aacs::AACSKeys::getKeys(java::lang::String*, dumphd::core::KeyData*)'
/dream/oe1.6/dm8000/build/tmp/cross/mipsel/lib/gcc/mipsel-oe-
linux/4.4.4/../../../../mipsel-oe-linux/lib/libgcj.so: undefined reference to 
`__data_start'
collect2: ld returned 1 exit status

cheers
Andreas

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

end of thread, other threads:[~2010-10-06 19:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-06  8:43 gcj static crosscompiling raises issues with boehm-gc Andreas Frisch
2010-10-06 14:25 ` Andrew Haley
2010-10-06 15:51   ` David Daney
2010-10-06 15:45 Andreas Frisch
2010-10-06 16:07 ` Andrew Haley
2010-10-06 16:53 Andreas Frisch
2010-10-06 17:07 ` David Daney
     [not found] <20101006175323.A6AC03148D76@mail.multimedia-labs.de>
2010-10-06 17:58 ` David Daney
2010-10-06 18:50 Andreas Frisch
2010-10-06 19:02 ` David Daney

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).