Red Hat Bugzilla – Bug 1004507
libgcj.a not installed with any gcc / libgcj related RPM
Last modified: 2013-09-04 15:32:14 EDT
Description of problem:
libgcj.a is needed to be able to have the gcj compiler work with the '-static-libgcj' parameter. libgjc.a is nowhere to be found on the filesystem.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Create a simple "hello world" type Java source file.
2.Compile with 'gcj -static-libgcj --main=HelloWorld ./HelloWorld.java -o Hello'
3.Witness the error.
[joel@f19 ~]$ gcj -static-libgcj ./HelloWorld.java -o Hello
/usr/bin/ld: cannot find -lgcj
collect2: error: ld returned 1 exit status
A binary that has statically linked with the libgcj libraries.
Building without the '-static-libgcj' works fine, but of course it now dynamically links to /lib64/libgcj.so.14 which is what we're trying to avoid.
Statically linking gcj doesn't really work, which is why we are intentionally not shipping libgcj.a.
If you want to compile/link programs that don't depend on particular libgcj.so version, use -findirect-dispatch (both for compilation and linking).