linker mysteries
Tomoyuki Murakami
tomoyuki at pobox.com
Fri Apr 14 12:32:11 UTC 2006
>>> On Thu, 13 Apr 2006 23:12:24 +0200,
>>> Jeremie Le Hen <jeremie at le-hen.org> wrote:
jeremie> If I comment out the variable assignements :
jeremie> % .if !defined(NO_CRYPT) && !defined(NO_OPENSSL)
jeremie> % #CFLAGS+= -DWITH_SSL
jeremie> % #DPADD= ${LIBSSL} ${LIBCRYPTO}
jeremie> % #LDADD= -lssl -lcrypto
jeremie> % .endif
jeremie>
jeremie> The resulting linker command is now :
jeremie> % /usr/bin/ld -V -Bshareable -o libfetch.so.4 /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/lib -x -soname libfetch.so.4 file.So http.So ftp.So common.So fetch.So -lgcc_pic -lgcc_pic /usr/lib/crtendS.o /usr/lib/crtn.o
jeremie>
jeremie> As you can see, we don't have "-lssl -lcrypto" any more. However, ldd(1)
jeremie> still says that libfetch.so is linked against those libraries :
jeremie> % jarjarbinks# ldd libfetch.so
jeremie> % libfetch.so:
jeremie> % libssl.so.4 => /usr/lib/libssl.so.4 (0x2c72e000)
jeremie> % libcrypto.so.4 => /lib/libcrypto.so.4 (0x2cd74000)
jeremie>
jeremie> Only linking addresses change, but they do at every compilation.
jeremie>
jeremie> I would be glad if someone could explain why this happens.
Makefile of libfetch includes
.include <bsd.lib.mk>
at last line, and, you can see /usr/share/mk/bsd.lib.mk includes
bsd.libnames.mk
this makefile has
....
.if defined(LDFLAGS) && !empty(LDFLAGS:M-static)
.if !defined(NO_KERBEROS) && !defined(NOCRYPT) &&
!defined(NO_OPENSSL)
LIBPAM+= ${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} \
${LIBROKEN} ${LIBCOM_ERR}
MINUSLPAM+= -lkrb5 -lasn1 -lcrypto -lcrypt -lroken -lcom_err
.endif
LIBPAM+= ${LIBRADIUS} ${LIBTACPLUS} ${LIBCRYPT} \
${LIBUTIL} ${LIBOPIE} ${LIBMD}
MINUSLPAM+= -lradius -ltacplus -lcrypt \
-lutil -lopie -lmd
....
So, if you wouldn't like to do with -lssl and -lcrypto,
define NO_CRYPTO and NO_OPENSSL appropriately. e.g. in make.conf.
---
Tomo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20060414/75a65983/attachment.pgp
More information about the freebsd-hackers
mailing list