This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
semi-static linux binary
- From: "Geoff Strom" <stromgt at speakeasy dot net>
- To: "Norbert Frese" <postfach at nfrese dot net>
- Cc: java at gcc dot gnu dot org
- Date: Thu, 23 Oct 2003 16:35:44 +0000
- Subject: semi-static linux binary
- Sensitivity: Normal
Here's what works for me to produce a semi-static binary under linux (using gcc 3.3.1):
1) hide libgcj.so.4.0.0 by renaming it.
2) export LD_LIBRARY_PATH=.
3) use -static-libgcc when linking your binary (don't use -static)
Running ldd on the resulting binary produces the following (redhat 8):
libm.so.6 => /lib/i686/libm.so.6 (0x40027000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x4004a000)
libdl.so.2 => /lib/libdl.so.2 (0x4009a000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
I then transferred the binary to another machine running redhat 9 (without gcc 3.3.1) and it ran fine.
-Geoff