From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shea Levy Subject: Re: [RFC] Reliable compiler specification setting (at least include/lib dirs) through the process environment Date: Tue, 18 Oct 2016 07:19:41 -0400 Message-ID: <87eg3d7vle.fsf@shlevy-laptop.i-did-not-set--mail-host-address--so-tickle-me> References: <87r37gp8dt.fsf@shlevy-laptop.i-did-not-set--mail-host-address--so-tickle-me> <87vawqm2je.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1575465645845182762==" Return-path: In-Reply-To: <87vawqm2je.fsf@gnu.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nix-dev-bounces@lists.science.uu.nl Errors-To: nix-dev-bounces@lists.science.uu.nl To: Ludovic =?utf-8?Q?Court=C3=A8s?= , nix-dev@lists.science.uu.nl, gcc@gcc.gnu.org, cfe-dev@lists.llvm.org Cc: Guix-devel List-Id: guix-devel.gnu.org --===============1575465645845182762== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo=E2=80=99, Your patches look good! My biggest concern is how the ld wrapper behaves in the presence of response files. Have you tested that? Thanks, Shea Ludovic Court=C3=A8s writes: > Hi Shea, > > Shea Levy skribis: > >> Unlike the traditional approach of installing system libraries into one >> central location like /usr/{lib,include}, the nix package manager [1] >> installs each package into it's own prefix >> (e.g. /nix/store/mn9kqag3d24v6q41x747zd7n5qnalch7-zlib-1.2.8-dev). Moreo= ver, >> each package is built in its own environment determined from its >> explicitly listed dependencies, regardless of what else is installed on >> the system. Because not all package build scripts properly respect >> CFLAGS etc., we currently wrap the compiler [2] to respect custom >> environment variables like NIX_CFLAGS_COMPILE, so during the build of a >> package that depends on zlib and Xlib might have NIX_CFLAGS_COMPILE set >> to "-isystem /nix/store/bl0rz2xinsm9yslghd7n5vaba86zxknh-libX11-1.6.3-de= v/include -isystem /nix/store/mn9kqag3d24v6q41x747zd7n5qnalch7-zlib-1.2.8-d= ev/include". >> >> Unfortunately, as you can see if you click through the link or look >> through the git history, the wrapper is quite complex (frankly, hacky) > >> [2]: https://github.com/NixOS/nixpkgs/blob/8cbdd9d0c290e294a9d783c8868e7= 38db05c9ce2/pkgs/build-support/cc-wrapper/cc-wrapper.sh > > Guix avoids the compiler wrapper altogether like this: > > =E2=80=A2 We use C_INCLUDE_PATH, LIBRARY_PATH, and friends: > . > > =E2=80=A2 We have a simple linker wrapper aimed at adding -Wl,-rpath fl= ags: > . > The comment in that file explains why the other options considered > were unsuitable. > > =E2=80=A2 We modify the built-in =E2=80=9Clib=E2=80=9D spec of GCC to a= dd the necessary -L and > -rpath flags: > . > > =E2=80=A2 Likewise, we tell Clang where to find libc and friends: > > . > > This is not too intrusive and more robust than wrapping everything. > > I suppose GCC and Clang could facilitate this by providing configure > options to augment the =E2=80=9Clib=E2=80=9D spec, specify the location o= f libc alone, > or something along these lines. > > Thoughts? > > Ludo=E2=80=99. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYBgVOAAoJEFwL1pV9hv4nvMoP/3c83zJ4dDyxlwD/ZG1rG9C1 FczZlLSTf2fYuMHQHG6yL2K/0CyHnRde0lkNekNzI92pZlsQBrY8JLlGH2xxj8nd 6tFEVJl8vX/qAD3qSlvMOcIm5EFGhtCPljXaaaA3WPmy8/kqHvZg1IkzRMR/2O5q VSOp7LZC1CbjGUqZZIv5zVPv8VXTij+OUHMQVDQkvqf2ta6asWNpXsaSh7iDPlrj 1OTLCCdjFKb1/SQtNtyXaeH2DMMV1vynsZ+g1NDigbibEIBqA31Qp2Gh6fnkY5wN KZnYzOjyeknTEEEZOUh0B6W/lwt9PJB/ubqlopPWtRkPfi05/fC2SY5b/rs9WwTA HF3UfRlv248RYzzsiD+vfzKRuCt3jKBBlwh1y864a2+WzSyWmCRu7MivKtwECPM6 wKc1JyLNwTHCLNHJEE3LXhTb4v7rQynROFADek3D6y3U3qsSRqp9aug89AU3qSlq 7Zvs1mO0IiDGYbqWe6vcVpuW1QK7QAaDAT5o1vMAP4CKDnlFtdKjg/jnw9nKSbVZ 0uDCikfSCTYvfTGkDE/sks9e9swtfcv2dC/ZHUjUHXUQy8Vp19DNKN12f+iduatH BXKZ94pwH0aEzaNuOVgvsjbwXzqT2hyjFuB1NA2vob7GDUIbOniVDhvQAtvjmgYo FMAY4ljavZEAsC+ocvi6 =Hdk4 -----END PGP SIGNATURE----- --=-=-=-- --===============1575465645845182762== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev --===============1575465645845182762==--