Static Link with Shared Object
Jason C. Wells
jcw at highperformance.net
Mon Dec 18 02:07:32 PST 2006
I was trying to create a static version of MIT's ksu in place of Heimdal
ksu so I can avoid having dualing kerberos libraries on my system.
(Heimdal ksu is borken IMHO.)
Does linking to a shared object cause the new object file to be shared also?
Stated another way: Why doesn't this produce a static binary?
ld -v -Bstatic -L/lib -L/usr/lib -o foo *.o ../../lib/libkrb5.so
../../lib/libcom_err.so ../../lib/libkrb5support.so
../../lib/libk5crypto.so /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/crtbegin.o /usr/lib/crtend.o /usr/lib/crtn.o -lgcc -lc -lgcc
ldd foo
foo:
../../lib/libkrb5.so (0x280e3000)
../../lib/libcom_err.so (0x2815e000)
../../lib/libkrb5support.so (0x28164000)
../../lib/libk5crypto.so (0x2816c000)
libk5crypto.so => /usr/local/lib/libk5crypto.so (0x2818f000)
libcom_err.so => /usr/local/lib/libcom_err.so (0x281b1000)
libkrb5support.so => /usr/local/lib/libkrb5support.so (0x281b6000)
root at s4 grrr
su: grrr: command not found
I cannot figure out how the (blankety blank) dynamic links are creeping
in. The only thing I can figure is that you're not supposed to link to
a *.so and your supposed to "just know" that doing so is noobish.
I am especially curious how the links to /usr/local are being found when
I haven't used -L/usr/local.
Thanks,
Jason C. Wells
More information about the freebsd-chat
mailing list