LibGCJ static linking trouble

Thomas Womack twomack@globalphasing.com
Wed Nov 15 17:40:00 GMT 2006


Hello all.
I'm following the instructions in
 http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
for compiling things so that they don't need libgcj.so at runtime.
The final link-it-all-together line in my makefile is (remove carriage 
returns as needed)
$(EXECOUT)/%: %-adaptor.o globalphasing/maketnt/%.o $(maketntlibs) $(javalibs)
 $(GCJ) -o $(EXECOUT)/$* $^ -shared-libgcc 
-Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as-needed -lz 
-lgcc_s -lpthread -lc -lm -ldl -Wl,--no-as-needed
where %-adaptor.o contains main(), which calls various bits of C code 
which do some setup and then calls into the compiled java following the 
model of
 http://www-ti.informatik.uni-tuebingen.de/~thiele/cni/
Unfortunately, whilst this produces enormous executables
twomack@harker:~> ls -l toadfarm/bin/linux/PDB2TNT
-rwxr-xr-x 1 twomack cdrom 19772164 2006年11月15日 17:21 toadfarm/bin/linux/PDB2TNT
twomack@harker:~> strip toadfarm/bin/linux/PDB2TNT
twomack@harker:~> ls -l toadfarm/bin/linux/PDB2TNT
-rwxr-xr-x 1 twomack cdrom 8260516 2006年11月15日 17:34 toadfarm/bin/linux/PDB2TNT
they don't appear to be statically linked:
twomack@harker:~> toadfarm/bin/linux/PDB2TNT
toadfarm/bin/linux/PDB2TNT: error while loading shared libraries: 
libgcj.so.7: cannot open shared object file: No such file or directory
twomack@harker:~> ldd toadfarm/bin/linux/PDB2TNT
 linux-gate.so.1 => (0xffffe000)
 libz.so.1 => /lib/libz.so.1 (0x5559b000)
 libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x555ae000)
 libpthread.so.0 => /lib/tls/libpthread.so.0 (0x555b9000)
 libc.so.6 => /lib/tls/libc.so.6 (0x555cb000)
 libdl.so.2 => /lib/libdl.so.2 (0x556ea000)
 libgcj.so.7 => not found
 libm.so.6 => /lib/tls/libm.so.6 (0x556ef000)
 /lib/ld-linux.so.2 (0x55555000)
Can you help?
Thomas Womack, Global Phasing Ltd.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /