Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2006 02:07:24 -0800
From:      "Jason C. Wells" <jcw@highperformance.net>
To:        freebsd-chat@freebsd.org
Subject:   Static Link with Shared Object
Message-ID:  <4586685C.1030909@highperformance.net>

next in thread | raw e-mail | index | archive | help
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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4586685C.1030909>