Skip to content

Commit

Permalink
gcc: leave setOutputFlags=false as it was before this PR
Browse files Browse the repository at this point in the history
Too many downstream packages depend on the idiosyncracy of gcc's
custom `installPhase`.  Letting `make install` decide where things
belong (i.e. `setOutputFlags=true` so `configureFlags` gets things
like `--libdir=`) would impose too many changes on other parts of
nixpkgs.

The `patchelf` line added in this commit preserves the most
important thing that `setOutputFlags` was accomplishing: no
references from $lib to $out.
  • Loading branch information
Adam Joseph committed Jan 18, 2023
1 parent 44ba883 commit 0411461
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkgs/development/compilers/gcc/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ lib.pipe (stdenv.mkDerivation ({
++ lib.optional (!langJit) "lib"
++ lib.optionals enableLibGccOutput [ "libgcc" ]
++ lib.optionals enableChecksum [ "checksum" ];
setOutputFlags = enableExternalBootstrap;
setOutputFlags = false;
NIX_NO_SELF_RPATH = true;

libc_dev = stdenv.cc.libc_dev;
Expand Down Expand Up @@ -326,12 +326,18 @@ lib.pipe (stdenv.mkDerivation ({
# in bash instead of nix (we should fix that).
preFixupPhases = (previousAttrs.preFixupPhases or []) ++ [ "postPostInstallPhase" ];
postPostInstallPhase = lib.optionalString langJit ''
# this is to keep clang happy
mv $out/lib/gcc/${targetPlatform.config}/${version}/* $out/lib/gcc/
rmdir $out/lib/gcc/${targetPlatform.config}/${version}
rmdir $out/lib/gcc/${targetPlatform.config}
'' + lib.optionalString enableLibGccOutput ''
# eliminate false lib->out references
find $lib/lib/ -name \*.so\* -exec patchelf --shrink-rpath {} \; || true
'' + lib.optionalString (!langC) ''
# delete extra/unused builds of libgcc_s to avoid potential confusion:
rm -f $out/lib/libgcc_s.so*
'' + lib.optionalString enableLibGccOutput (''
# move libgcc from lib to its own output (libgcc)
mkdir -p $libgcc/lib
mv $lib/lib/libgcc_s.so $libgcc/lib/
mv $lib/lib/libgcc_s.so.1 $libgcc/lib/
Expand Down

0 comments on commit 0411461

Please sign in to comment.