From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shea Levy via cfe-dev Subject: Re: [RFC] Reliable compiler specification setting (at least include/lib dirs) through the process environment Date: Tue, 18 Oct 2016 07:03:10 -0400 Message-ID: <87k2d57wcx.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> Reply-To: Shea Levy Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6197597588024972120==" Return-path: In-Reply-To: <87vawqm2je.fsf-mXXj517/zsQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cfe-dev-bounces-NBbBogny7ofFcdTEL8lfRQ@public.gmane.org Sender: "cfe-dev" To: Ludovic =?utf-8?Q?Court=C3=A8s?= , nix-dev-rGrgPyRx506NN8uzcEdRPYRWq/SkRNHw@public.gmane.org, gcc-/MQLu3FmUzdAfugRpC6u6w@public.gmane.org, cfe-dev-NBbBogny7ofFcdTEL8lfRQ@public.gmane.org Cc: Guix-devel List-Id: guix-devel.gnu.org --===============6197597588024972120== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hey Ludo=E2=80=99, Amazing, more than a decade of close working with these tools and I never knew about C_INCLUDE_PATH et al! It looks like those will solve a huge portion of the problem. Will look at your gcc and clang patches as well, thank you! ~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----- iQIcBAEBCAAGBQJYBgFuAAoJEFwL1pV9hv4n6PMQAJkmNybNBb9QVOqK4FkD5Tzz G0IicqaVJV+5fJ2LiflfbDVmHyzNN7ns/MDKCiqVM0TZWwQ2G5bvCevGclX40wQt LVNCBGG5Gpy9sWNKaTnmWaaBxa3Fj1bcqVV/KAGzmHIQ+mgofOzrtFVnKB6/hXCN mojZE/yaxEJQPMdphaU1Q8RqqkNoFAHUCZeUEfyMTVdc53J8df0G+NnmRFuyMHIA QwhA8N66aG6iAUD3QAwCYHmTQMFz8UYCBE97zEzVWh3plmvnNLLY0m0YRFd1W6vb gIUedobC0zvGE8mpsUc+ki9O1OriI82Tqt8bovcUeto1NvmrK9DeA9U6okPSKydk R1XZ7avWZ9poQAKm6Amax6eFYlEkhz83r41NrlEyNvrW9AOjZ7sBwXD5y1dUDHsh XyUy+kvmy9PjFdVYyEmGjhgSH+OtL6E/QjX2YeLhJIFesCqI02c4MnkgAZM3mVPM cUzVqRT3kwuYJwfb2O334IPt0BIjEPAQaASdQFHqdGpXt5Y6YjP6j0lYrj9Gi6bo glE0CIQrSFhKUUNq6f50M7qwtSi2dCSXWiR5MvBe8PYOpMBas0cWTlzyXXUCWacW I30Z3iBYlhctuRvCZklK9BWLUZlBMzMdH2TJRTnO+pTn3wJi9mVDodFlljBMDCTS 8QvyNwKkEShoJlc0C0Uo =vYnl -----END PGP SIGNATURE----- --=-=-=-- --===============6197597588024972120== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KY2ZlLWRldiBt YWlsaW5nIGxpc3QKY2ZlLWRldkBsaXN0cy5sbHZtLm9yZwpodHRwOi8vbGlzdHMubGx2bS5vcmcv Y2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL2NmZS1kZXYK --===============6197597588024972120==--