From owner-freebsd-hackers@FreeBSD.ORG Sat Dec 15 10:56:47 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC3FC85A for ; Sat, 15 Dec 2012 10:56:47 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 63EA08FC18 for ; Sat, 15 Dec 2012 10:56:47 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id u54so1960980wey.13 for ; Sat, 15 Dec 2012 02:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=oGk43HTgH+2KYcU+4vdoXWMsp0J7ZUmrq12nWM7kAPo=; b=SvsRtMW5fcRjoBQ1HCthSrHhutR4AOXeYQ2Jy3IO+h4+Vf10CbGqTQ4BZxxMyq1dHm aqUGZDHF9clCkzgCZrUZtnVXmmrnNkrmddpoDPT1sMuWDRrDuGqKRyp+c0WyB3ITJWPW KLNK6G9vI1SOaSKfdLFqcMTQs9tXCahHDUdVqOM6viXdWh2PRyiVOl2I/ZfEFxBQx0NS aPnzxyXZ+E8m2UC4DlA8OUgJVbhI0q8TEiyLrua6bWWNHU+Y3cJeFWpgtzdxEKkAxa95 oGPLmIYaduA2xuBxDcNVr/5VvZwWsKsRtbIhFK1dTIii8nCb2Ko3pndHKhGmgWe+2fPG xu/A== Received: by 10.180.80.168 with SMTP id s8mr7023233wix.8.1355569005409; Sat, 15 Dec 2012 02:56:45 -0800 (PST) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPS id i2sm1544449wiw.3.2012.12.15.02.56.44 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Dec 2012 02:56:44 -0800 (PST) Sender: Baptiste Daroussin Date: Sat, 15 Dec 2012 11:56:43 +0100 From: Baptiste Daroussin To: Konstantin Belousov Subject: Re: Fix overlinking in base aka import pkgconf Message-ID: <20121215105643.GG18884@ithaqua.etoilebsd.net> References: <20121214235418.GF18884@ithaqua.etoilebsd.net> <20121215012233.GP71906@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HKEL+t8MFpg/ASTE" Content-Disposition: inline In-Reply-To: <20121215012233.GP71906@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2012 10:56:47 -0000 --HKEL+t8MFpg/ASTE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 15, 2012 at 03:22:34AM +0200, Konstantin Belousov wrote: > On Sat, Dec 15, 2012 at 12:54:19AM +0100, Baptiste Daroussin wrote: > > Hi, > >=20 > > Some of our binary are overlinked, the way we handle the linking doesn'= t help > > for that. > What do you mean there ? Do you mean that some libraries specified for the > linking stage of the final binary are not needed for the execution ? I mean some library are registrer in the binary with DT_NEEDED tag where th= ey don't need to. >=20 > >=20 > > On proposition could be to use pkgconf https://github.com/pkgconf/pkgco= nf which > > is BSD license pkg-config implementation 100% compatible with pkg-confi= g. > >=20 > > What I propose is to create a new PCADD variable for the Makefiles. > >=20 > > PCADD will invoke pkgconf to gather the libraries and the cflags for a = given > > project. > >=20 > > The second thing would be to create .pc files for all of our libraries. > >=20 > > for example: > > usr.bin/fstat dynamic build is overlinked > And how this is better than just removing the unneeded library from > the Makefile ? In that case to statically build you need -lkvm -lutil -lprocstat but if you build dynamically you will only need -lproctast meaning you don't need to be directly linked to libutil and libkvm. This means a breakage of libutil will only have inpact on procstat and no more on fstat for example. >=20 > For the port consumption, I believe that the better solution is to provide > a pack of the .pc files describing base libraries, most likely as port. Yeah the port is another thing which yes can probably be done that way. >=20 > Using .pc for the base system build is overkill, it does not add anything > that cannot be accomplished by our existing build system. IMO. Probably. The thing is with pkgconf, fstat does not need to know that procstat needs libkvm and libutil for static link, it just has to know it needs proc= stat and pkgconf does all the magic. and pkgconf is really small (only 48k on an amd64 box) Other solution would be to reinvent the same thing using our framework? Maybe a LDSADD (LD STATIC ADD) to differenciate both? regards, Bapt --HKEL+t8MFpg/ASTE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlDMV2sACgkQ8kTtMUmk6EywggCfcYWzp3/daYFKOwX3YD1gFgDK rLIAn1iujMVzzxGDTw5iqpQfFlZVuiLe =xxMg -----END PGP SIGNATURE----- --HKEL+t8MFpg/ASTE--