gcj -static (redhat linux)
Rutger Ovidius
ovid@mailandnews.com
Fri Sep 12 06:01:00 GMT 2003
Hi,
I run RedHat9,
gcc version 3.3.1 20030903 (Red Hat Linux 3.3.1-3) (from rpmfind.net)
I can compile with shared libraries, but "-static" builds unusable binaries.
gcj --main=net.mldonkey.g2gui.view.G2Gui -static -o g2gui $LIBS/*.o -L.
-Wl,-Bdynamic -lswt-gtk-2135 -lswt-pi-gtk-2135
sh: ./g2gui: /usr/lib/libc.so.1: bad ELF interpreter: No such file or
directory
What am I doing wrong?
--
But, even when I build dynamic, I have to "hide" libgcj.so* if I want to link
that one lib statically.
gcj --main=net.mldonkey.g2gui.view.G2Gui -static-libgcc -Wl,-rpath,. -s -o
$EXE $LIBS/*.o -Wl,-Bstatic -lgcj -Wl,-Bdynamic -L. -lswt-gtk-2135
-lswt-pi-gtk-2135
does not work, since libgcj.spec has:
%rename lib liborig
*lib: -lgcj -lm -lpthread -lz -ldl %(libgcc) %(liborig)
(so the linker is already picking up the -lgcj dynamic library, and will yield
a "Duplicate class" error when I run my binary unless I "hide" libgcj.so*)
- or edit libgcj.spec which I don't really want to do each time
- or (I assume) use -specs=<file> which isn't as portable as cmdline switches.
Is there a better way around this?
Thanks.
More information about the Java
mailing list