Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2006 21:31:52 +0900 (JST)
From:      Tomoyuki Murakami <tomoyuki@pobox.com>
To:        jeremie@le-hen.org
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: linker mysteries
Message-ID:  <20060414.213152.74737565.tomoyuki@pobox.com>
In-Reply-To: <20060413211224.GO71412@obiwan.tataz.chchile.org>
References:  <20060413211224.GO71412@obiwan.tataz.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart(Fri_Apr_14_21_31_52_2006_253)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


>>> On Thu, 13 Apr 2006 23:12:24 +0200,
>>>  Jeremie Le Hen <jeremie@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

----Security_Multipart(Fri_Apr_14_21_31_52_2006_253)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iQCVAwUARD+WPscdBA2xrHKhAQIT7QP7BUxbukLWLYdgs/xveGrm57MAQuM29Cht
ECTB6d6o5a2QGkeuSXuPndeASqz5u/YMdcJHoQjmd3YR9dAd4nOWbtKaDcwvppML
z1k82Qmn09NYUSpLwEZxqWpHc/RDAFo6NW9xpPjtnCYHAdzQyu0FE1z25h+SvYn3
op8yfFzzzzE=
=Lx3J
-----END PGP SIGNATURE-----

----Security_Multipart(Fri_Apr_14_21_31_52_2006_253)----



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