Red Hat Bugzilla – Bug 163099
gcj - undefined references when linking multiple .java files with a static lib
Last modified: 2014-08-11 01:46:26 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050623 Fedora/1.0.4-5 Firefox/1.0.4
Description of problem:
When compiling multiple (as opposed to a single) java source files and linking with a static library the linker gives unresolved symbols for the classes in the library.
If you examine gcj -v output you can see that the library parameters to collect2 are out of order.
Compiling a single file works, so does compiling multiple into objects and then linking.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a static library
2. Create at least two files, one of which uses a class in the library
3. Compile linking to library
Actual Results: Undefined reference of the classes in the library
Expected Results: Should compile
collect2 ... /tmp/ccTBtUMj.o libtest.a /tmp/cc5arF0n.o ...
/tmp/cc5arF0n.o(.text+0x38): In function `Main::main(JArray<java::lang::String*>*)':
ccVcD1Gyjx: undefined reference to `TestClass::class$
Created attachment 116686 [details]
check Makefile targets, it also tests that single file works fine and that
compiling to objects works fine.
I'm testing a patch.
I checked the fix in to gcc cvs head.
I'm not really sure what to do with this PR... close it?
Put the bug in RH gcc 4.0.1 and close it?
This is in gcc-4.0.1-3 in rawhide.