diff --git a/doc/stdenv.xml b/doc/stdenv.xml index 5d6d9f595097..dac53bc2b800 100644 --- a/doc/stdenv.xml +++ b/doc/stdenv.xml @@ -1,3 +1,4 @@ + @@ -1341,58 +1342,33 @@ someVar=$(stripHash $name) - - Binutils Wrapper - - - Binutils Wrapper wraps the binary utilities for a bunch of miscellaneous purposes. - Specifically, GNU Binutils (for Linux, but a mix of cctools and GNU Binutils for Darwin), and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by Binutils Wrapper. - Packages typically depend on CC Wrapper, which in turn (at run time) depends on binutils-wrapper. - - - Binutils Wrapper was only just recently split off from CC Wrapper, so the division of labor is still being worked out. - For example, it shouldn't care about about the C standard library, but just take a derivation with the dynamic loader (which happens to be the glibc on linux). - Dependency finding however is a task both wrappers will continue to need to share, and probably the most important to understand. - It is currently accomplished by collecting directories of host-platform dependencies (i.e. buildInputs and nativeBuildInputs) in environment variables. - Binutils Wrapper's setup hook causes any lib and lib64 subdirectories to NIX_LDFLAGS. - Sine CC Wrapper and Binutils Wrapper use the same strategy, most of the Binutils Wrapper code is sparsely commented and refers to CC Wrapper. - But CC Wrapper's code, by contrast, has quite lengthy comments. - Binutils Wrapper merely cites those, rather than repeating them, to avoid falling out of sync. - - - A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables full-fill which purpose. - They are defined to just be the base name of the tools, under the assumption that Binutils Wrapper's binaries will be on the path. - Firstly, this helps poorly-written packages, e.g. ones that look for just gcc when CC isn't defined yet clang is to be used. - Secondly, this helps packages not get confused when cross-compiling, in which case multiple Binutils Wrappers may be simultaneous in use (targeting different platforms). - BUILD_- and TARGET_-prefixed versions of the normal environment variable are defined for the additional Binutils Wrappers, properly disambiguating them. - - - A problem with this final task is that Binutils Wrapper is honest and defines LD as ld. - Most packages, however, firstly use the C compiler for linking, secondly use LD anyways, defining it as the C compiler, and thirdly, only so define LD when it is undefined as a fallback. - This triple-threat means Binutils Wrapper will break those packages, as LD is already defined as the actually linker which the package won't override yet doesn't want to use. - The workaround is to define, just for the problematic package, LD as the C compiler. - A good way to do this would be preConfigure = "LD=$CC". - - - - CC Wrapper CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes. - Specifically, a C compiler (GCC or Clang), Binutils (or the CCTools + binutils mashup when targetting Darwin), and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by Binutils Wrapper. - Packages typically depend on CC Wrapper, which in turn (at run time) depends on Binutils Wrapper. + Specifically, a C compiler (GCC or Clang), Binutils (or the CCTools + binutils mashup when targetting Darwin), and a C standard library (glibc or Darwin's libSystem) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by CC Wrapper. + Packages typically depend on only CC Wrapper, instead of those 3 inputs directly. - Dependency finding is undoubtedly the main task of CC Wrapper. - This works just like Binutils Wrapper, except the any include subdirectory of any relevant dependency is added to NIX_CFLAGS_COMPILE. + Dependency finding is undoubtedly the main task of CC wrapper. + It is currently accomplished by collecting directories of host-platform dependencies (i.e. buildInputs and nativeBuildInputs) in environment variables. + CC wrapper's setup hook causes any include subdirectory of such a dependency to be added to NIX_CFLAGS_COMPILE, and any lib and lib64 subdirectories to NIX_LDFLAGS. The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished. - CC Wrapper also like Binutils Wrapper defines standard environment variables with the names of the tools it wraps, for the same reasons described above. - Importantly, while it includes a cc symlink to the c compiler for portability, the CC will be defined using the compiler's "real name" (i.e. gcc or clang). - This helps lousy build systems that inspect on the name of the compiler rather than run it. + A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables full-fill which purpose. + They are defined to just be the base name of the tools, under the assumption that CC Wrapper's binaries will be on the path. + Firstly, this helps poorly-written packages, e.g. ones that look for just gcc when CC isn't defined yet clang is to be used. + Secondly, this helps packages not get confused when cross-compiling, in which case multiple CC wrappers may be simultaneous in use (targeting different platforms). + BUILD_- and TARGET_-prefixed versions of the normal environment variable are defined for the additional CC Wrappers, properly disambiguating them. + + + A problem with this final task is that CC Wrapper is honest and defines LD as ld. + Most packages, however, firstly use the C compiler for linking, secondly use LD anyways, defining it as the C compiler, and thirdly, only so define LD when it is undefined as a fallback. + This triple-threat means CC Wrapper will break those packages, as LD is already defined as the actually linker which the package won't override yet doesn't want to use. + The workaround is to define, just for the problematic package, LD as the C compiler. + A good way to do this would be preConfigure = "LD=$CC". diff --git a/pkgs/applications/audio/google-musicmanager/default.nix b/pkgs/applications/audio/google-musicmanager/default.nix index 27ce9eb3d133..72bec52b2663 100644 --- a/pkgs/applications/audio/google-musicmanager/default.nix +++ b/pkgs/applications/audio/google-musicmanager/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { buildPhase = '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/opt/google/musicmanager:${stdenv.lib.makeLibraryPath [ readline ncurses stdenv.cc.libc.out qt48 stdenv.cc.cc libidn expat flac libvorbis ]}" opt/google/musicmanager/MusicManager ''; diff --git a/pkgs/applications/audio/google-play-music-desktop-player/default.nix b/pkgs/applications/audio/google-play-music-desktop-player/default.nix index 2f235966a399..9d9af6311832 100644 --- a/pkgs/applications/audio/google-play-music-desktop-player/default.nix +++ b/pkgs/applications/audio/google-play-music-desktop-player/default.nix @@ -61,7 +61,7 @@ stdenv.mkDerivation { cp -r ./usr/share $out cp -r ./usr/bin $out - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ "$out/share/google-play-music-desktop-player/Google Play Music Desktop Player" wrapProgram $out/bin/google-play-music-desktop-player \ diff --git a/pkgs/applications/audio/renoise/default.nix b/pkgs/applications/audio/renoise/default.nix index 6b780cf0a756..d02c551be8af 100644 --- a/pkgs/applications/audio/renoise/default.nix +++ b/pkgs/applications/audio/renoise/default.nix @@ -49,7 +49,7 @@ stdenv.mkDerivation rec { mkdir $out/bin ln -s $out/renoise $out/bin/renoise - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) --set-rpath $out/lib $out/renoise + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath $out/lib $out/renoise ''; meta = { diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix index 29019c14f85b..ad0f7ee14c5a 100644 --- a/pkgs/applications/audio/spotify/default.nix +++ b/pkgs/applications/audio/spotify/default.nix @@ -89,7 +89,7 @@ stdenv.mkDerivation { rpath="$out/share/spotify:$libdir" patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $rpath $out/share/spotify/spotify librarypath="${stdenv.lib.makeLibraryPath deps}:$libdir" diff --git a/pkgs/applications/editors/atom/default.nix b/pkgs/applications/editors/atom/default.nix index 2238aafee706..e3e889abd87f 100644 --- a/pkgs/applications/editors/atom/default.nix +++ b/pkgs/applications/editors/atom/default.nix @@ -25,10 +25,10 @@ stdenv.mkDerivation rec { fixupPhase - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${atomEnv.libPath}:$out/share/atom" \ $out/share/atom/atom - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${atomEnv.libPath}" \ $out/share/atom/resources/app/apm/bin/node diff --git a/pkgs/applications/editors/brackets/default.nix b/pkgs/applications/editors/brackets/default.nix index 2dd43f9ba3cf..23cb16c0733f 100644 --- a/pkgs/applications/editors/brackets/default.nix +++ b/pkgs/applications/editors/brackets/default.nix @@ -36,11 +36,11 @@ stdenv.mkDerivation rec { ''; postFixup = '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${bracketsLibs}:$out/opt/brackets/lib" \ $out/opt/brackets/Brackets - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${bracketsLibs}" \ $out/opt/brackets/Brackets-node diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index 5c042f2fe49e..95f3c0801d2a 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -35,7 +35,7 @@ let ln -s ${cmake} bin/cmake lldbLibPath=$out/clion-${version}/bin/lldb/lib - interp="$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" + interp="$(cat $NIX_CC/nix-support/dynamic-linker)" ln -s ${ncurses.out}/lib/libncurses.so $lldbLibPath/libtinfo.so.5 patchelf --set-interpreter $interp \ diff --git a/pkgs/applications/editors/kodestudio/default.nix b/pkgs/applications/editors/kodestudio/default.nix index ef07d7515aaf..a0e941289099 100644 --- a/pkgs/applications/editors/kodestudio/default.nix +++ b/pkgs/applications/editors/kodestudio/default.nix @@ -50,31 +50,31 @@ in postFixup = lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") '' # Patch Binaries patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out:${atomEnv.libPath}" \ $out/kodestudio patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib:${xorg.libXinerama}/lib:${xorg.libX11}/lib:${alsaLib}/lib:${mesa}/lib:${openssl.out}/lib" \ $out/resources/app/extensions/krom/Krom/linux/Krom patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib" \ $out/resources/app/extensions/kha/Kha/Kore/Tools/krafix/krafix-linux64 patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib" \ $out/resources/app/extensions/kha/Kha/Kore/Tools/kraffiti/kraffiti-linux64 patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib:${stdenv.cc.cc.lib}/lib" \ $out/resources/app/extensions/kha/Kha/Tools/kravur/kravur-linux64 patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib:${zlib}/lib" \ $out/resources/app/extensions/kha/Kha/Tools/haxe/haxe-linux64 patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ".:${stdenv.cc.libc}/lib:${libvorbis}/lib:${libogg}/lib:${flac.out}/lib" \ $out/resources/app/extensions/kha/Kha/Tools/oggenc/oggenc-linux64 diff --git a/pkgs/applications/editors/lighttable/default.nix b/pkgs/applications/editors/lighttable/default.nix index d16d2d2cc649..74a83c1278af 100644 --- a/pkgs/applications/editors/lighttable/default.nix +++ b/pkgs/applications/editors/lighttable/default.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { mv ./${name}-linux/* $out/share/LightTable patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath}:${libPath}/lib64:$out/share/LightTable \ $out/share/LightTable/LightTable diff --git a/pkgs/applications/editors/sublime/default.nix b/pkgs/applications/editors/sublime/default.nix index 57e00f7227da..9cf5bd97d0a3 100644 --- a/pkgs/applications/editors/sublime/default.nix +++ b/pkgs/applications/editors/sublime/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { echo ${libPath} patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \ $out/sublime/sublime_text diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime3/default.nix index aa19a2ca19af..c295313621e3 100644 --- a/pkgs/applications/editors/sublime3/default.nix +++ b/pkgs/applications/editors/sublime3/default.nix @@ -50,7 +50,7 @@ in let buildPhase = '' for i in sublime_text plugin_host crash_reporter; do patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \ $i done diff --git a/pkgs/applications/editors/typora/default.nix b/pkgs/applications/editors/typora/default.nix index 4be9b6dda20f..0733bd796656 100644 --- a/pkgs/applications/editors/typora/default.nix +++ b/pkgs/applications/editors/typora/default.nix @@ -66,7 +66,7 @@ stdenv.mkDerivation rec { postFixup = '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/share/typora:${rpath}" "$out/share/typora/Typora" ln -s "$out/share/typora/Typora" "$out/bin/typora" diff --git a/pkgs/applications/editors/vscode/default.nix b/pkgs/applications/editors/vscode/default.nix index 3457429f4dba..1f91bdfa3a58 100644 --- a/pkgs/applications/editors/vscode/default.nix +++ b/pkgs/applications/editors/vscode/default.nix @@ -72,7 +72,7 @@ in postFixup = lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${rpath}" \ $out/lib/vscode/code ''; diff --git a/pkgs/applications/graphics/draftsight/default.nix b/pkgs/applications/graphics/draftsight/default.nix index 32cce492589d..17334c5b366c 100644 --- a/pkgs/applications/graphics/draftsight/default.nix +++ b/pkgs/applications/graphics/draftsight/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation { mkdir $out/bin for exe in DraftSight dsHttpApiController dsHttpApiService FxCrashRptApp HelpGuide; do echo "Patching $exe..." - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath:\$ORIGIN/../Libraries \ $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe makeWrapper $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe \ diff --git a/pkgs/applications/misc/adobe-reader/builder.sh b/pkgs/applications/misc/adobe-reader/builder.sh index 75a2bdcf4b01..41281385c990 100644 --- a/pkgs/applications/misc/adobe-reader/builder.sh +++ b/pkgs/applications/misc/adobe-reader/builder.sh @@ -17,7 +17,7 @@ rm $p/Reader/intellinux/plug_ins/PPKLite.api # More pointless files. rm $p/bin/UNINSTALL -patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ +patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath \ $p/Reader/intellinux/bin/acroread diff --git a/pkgs/applications/misc/googleearth/default.nix b/pkgs/applications/misc/googleearth/default.nix index b343c1bf785e..df8cb71d6f9e 100644 --- a/pkgs/applications/misc/googleearth/default.nix +++ b/pkgs/applications/misc/googleearth/default.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation rec { rm $out/bin/google-earth $out/opt/google/earth/free/google-earth ln -s $out/opt/google/earth/free/googleearth $out/bin/google-earth - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${fullPath}:\$ORIGIN" \ $out/opt/google/earth/free/googleearth-bin diff --git a/pkgs/applications/misc/houdini/runtime.nix b/pkgs/applications/misc/houdini/runtime.nix index c2fe99744d17..b3ce98895e6f 100644 --- a/pkgs/applications/misc/houdini/runtime.nix +++ b/pkgs/applications/misc/houdini/runtime.nix @@ -67,7 +67,7 @@ stdenv.mkDerivation rec { echo "export QT_XKB_CONFIG_ROOT="${xkeyboardconfig}/share/X11/xkb"" >> $out/houdini/sbin/app_init.sh ''; postFixup = '' - INTERPRETER="$(cat "$NIX_BINUTILS/nix-support/dynamic-linker")" + INTERPRETER="$(cat "$NIX_CC"/nix-support/dynamic-linker)" for BIN in $(find $out/bin -type f -executable); do if patchelf $BIN 2>/dev/null ; then echo "Patching ELF $BIN" diff --git a/pkgs/applications/misc/hyper/default.nix b/pkgs/applications/misc/hyper/default.nix index ba18e346a2fa..3c9eeac891db 100644 --- a/pkgs/applications/misc/hyper/default.nix +++ b/pkgs/applications/misc/hyper/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { mkdir -p "$out/bin" mv opt "$out/" ln -s "$out/opt/Hyper/hyper" "$out/bin/hyper" - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath "${libPath}:\$ORIGIN" "$out/opt/Hyper/hyper" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${libPath}:\$ORIGIN" "$out/opt/Hyper/hyper" mv usr/* "$out/" ''; dontPatchELF = true; diff --git a/pkgs/applications/misc/ipmiview/default.nix b/pkgs/applications/misc/ipmiview/default.nix index dd43e703d350..f90784759941 100644 --- a/pkgs/applications/misc/ipmiview/default.nix +++ b/pkgs/applications/misc/ipmiview/default.nix @@ -17,8 +17,8 @@ stdenv.mkDerivation rec { buildPhase = with xorg; '' patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libX11 libXext libXrender libXtst libXi ]}" ./jre/lib/amd64/xawt/libmawt.so patchelf --set-rpath "${gcc.cc}/lib" ./libiKVM64.so - patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libXcursor libX11 libXext libXrender libXtst libXi ]}" --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" ./jre/bin/javaws - patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" ./jre/bin/java + patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libXcursor libX11 libXext libXrender libXtst libXi ]}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/javaws + patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/java ''; installPhase = '' diff --git a/pkgs/applications/misc/kdbplus/default.nix b/pkgs/applications/misc/kdbplus/default.nix index f3855f2bb925..bf1b77534ce6 100644 --- a/pkgs/applications/misc/kdbplus/default.nix +++ b/pkgs/applications/misc/kdbplus/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { mkdir -p $out/bin $out/libexec patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath} \ ./q/l32/q mv ./q/l32/q $out/libexec/q diff --git a/pkgs/applications/misc/kiwix/default.nix b/pkgs/applications/misc/kiwix/default.nix index 2459b3c411e5..c5b75a0be555 100644 --- a/pkgs/applications/misc/kiwix/default.nix +++ b/pkgs/applications/misc/kiwix/default.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation rec { postInstall = '' cp -r src/dependencies/xulrunner $out/lib/kiwix - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/lib/kiwix/xulrunner/xulrunner + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/lib/kiwix/xulrunner/xulrunner rm $out/bin/kiwix makeWrapper $out/lib/kiwix/kiwix-launcher $out/bin/kiwix \ diff --git a/pkgs/applications/misc/rescuetime/default.nix b/pkgs/applications/misc/rescuetime/default.nix index 50f09ce1b5cf..03d058783b23 100644 --- a/pkgs/applications/misc/rescuetime/default.nix +++ b/pkgs/applications/misc/rescuetime/default.nix @@ -33,7 +33,7 @@ stdenv.mkDerivation { cp usr/bin/rescuetime $out/bin ${patchelf}/bin/patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/rescuetime wrapProgram $out/bin/rescuetime \ diff --git a/pkgs/applications/misc/simplenote/default.nix b/pkgs/applications/misc/simplenote/default.nix index c84c25038d6c..7367c8207054 100644 --- a/pkgs/applications/misc/simplenote/default.nix +++ b/pkgs/applications/misc/simplenote/default.nix @@ -47,7 +47,7 @@ fixupPhase - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${libPath}:$out/share/simplenote" \ $out/share/simplenote/simplenote diff --git a/pkgs/applications/networking/bittorrentsync/generic.nix b/pkgs/applications/networking/bittorrentsync/generic.nix index 342385c4b001..3fa7fe180402 100644 --- a/pkgs/applications/networking/bittorrentsync/generic.nix +++ b/pkgs/applications/networking/bittorrentsync/generic.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { installPhase = '' install -D btsync "$out/bin/btsync" - patchelf --interpreter "$(< $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath ${libPath} "$out/bin/btsync" + patchelf --interpreter "$(< $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${libPath} "$out/bin/btsync" ''; meta = { diff --git a/pkgs/applications/networking/browsers/firefox-bin/default.nix b/pkgs/applications/networking/browsers/firefox-bin/default.nix index 8abcb0cfaac0..f59cb402720d 100644 --- a/pkgs/applications/networking/browsers/firefox-bin/default.nix +++ b/pkgs/applications/networking/browsers/firefox-bin/default.nix @@ -152,7 +152,7 @@ stdenv.mkDerivation { updater crashreporter webapprt-stub do if [ -e "$out/usr/lib/firefox-bin-${version}/$executable" ]; then - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ "$out/usr/lib/firefox-bin-${version}/$executable" fi done diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix index ad79aef88a40..9a4d90701b28 100644 --- a/pkgs/applications/networking/browsers/google-chrome/default.nix +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -130,7 +130,7 @@ in stdenv.mkDerivation rec { for elf in $out/share/google/$appname/{chrome,chrome-sandbox,nacl_helper}; do patchelf --set-rpath $rpath $elf - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $elf + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $elf done ''; diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix index cc076fa02f07..0452e7486e6f 100644 --- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix +++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix @@ -118,7 +118,7 @@ stdenv.mkDerivation rec { $out/lib${lib_suffix}/kde4/kcm_adobe_flash_player.so patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$rpath" \ $out/bin/flash-player-properties ''; diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix index 9c37979a359b..9a805eb55e4f 100644 --- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix +++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix @@ -84,7 +84,7 @@ stdenv.mkDerivation rec { cp -pv flashplayer${lib.optionalString debug "debugger"} $out/bin patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$rpath" \ $out/bin/flashplayer${lib.optionalString debug "debugger"} ''; diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix index 2e815f77780f..461db272b12e 100644 --- a/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix +++ b/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation rec { cp -prd opt/google/talkplugin/{data,GoogleTalkPlugin,locale,remoting24x24.png,windowpicker.glade} $out/libexec/google/talkplugin/ patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${rpathProgram}:${stdenv.cc.cc.lib}/lib64" \ $out/libexec/google/talkplugin/GoogleTalkPlugin diff --git a/pkgs/applications/networking/browsers/opera/default.nix b/pkgs/applications/networking/browsers/opera/default.nix index 66eaf8ecfba3..52a2ce9164c9 100644 --- a/pkgs/applications/networking/browsers/opera/default.nix +++ b/pkgs/applications/networking/browsers/opera/default.nix @@ -114,7 +114,7 @@ in stdenv.mkDerivation { | while read f do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/lib:${rpath}" \ "$f" done diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix index 7967fe539799..756ed095991c 100644 --- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix +++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix @@ -129,7 +129,7 @@ stdenv.mkDerivation rec { buildCommand = '' # For convenience ... TBB_IN_STORE=$out/share/tor-browser - interp=$(< $NIX_BINUTILS/nix-support/dynamic-linker) + interp=$(< $NIX_CC/nix-support/dynamic-linker) # Unpack & enter mkdir -p "$TBB_IN_STORE" diff --git a/pkgs/applications/networking/browsers/vivaldi/default.nix b/pkgs/applications/networking/browsers/vivaldi/default.nix index 7c6ad60116ca..a1238cb5964f 100644 --- a/pkgs/applications/networking/browsers/vivaldi/default.nix +++ b/pkgs/applications/networking/browsers/vivaldi/default.nix @@ -43,7 +43,7 @@ stdenv.mkDerivation rec { buildPhase = '' echo "Patching Vivaldi binaries" patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${libPath}" \ opt/vivaldi/vivaldi-bin '' + stdenv.lib.optionalString proprietaryCodecs '' diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix index dcbf609d08e7..9af4cf3f0ed6 100644 --- a/pkgs/applications/networking/cluster/hadoop/default.nix +++ b/pkgs/applications/networking/cluster/hadoop/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { sed -i $n -e "s|#!/usr/bin/env bash|#! ${bash}/bin/bash|" done '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" bin/container-executor; + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" bin/container-executor; ''; installPhase = '' diff --git a/pkgs/applications/networking/dropbox/default.nix b/pkgs/applications/networking/dropbox/default.nix index 975c5e4a87be..a76d6bc2fa47 100644 --- a/pkgs/applications/networking/dropbox/default.nix +++ b/pkgs/applications/networking/dropbox/default.nix @@ -108,7 +108,7 @@ in mkDerivation { ''; preFixup = '' - INTERP=$(cat $NIX_BINUTILS/nix-support/dynamic-linker) + INTERP=$(cat $NIX_CC/nix-support/dynamic-linker) RPATH="${ldpath}:$out/${appdir}" getType='s/ *Type: *\([A-Z]*\) (.*/\1/' find "$out/${appdir}" -type f -print | while read obj; do diff --git a/pkgs/applications/networking/instant-messengers/discord/default.nix b/pkgs/applications/networking/instant-messengers/discord/default.nix index 701ba477bee5..853a6c96a7a4 100644 --- a/pkgs/applications/networking/instant-messengers/discord/default.nix +++ b/pkgs/applications/networking/instant-messengers/discord/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { # Copying how adobe-reader does it, # see pkgs/applications/misc/adobe-reader/builder.sh - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/opt/discord:$libPath" \ $out/opt/discord/Discord diff --git a/pkgs/applications/networking/instant-messengers/franz/default.nix b/pkgs/applications/networking/instant-messengers/franz/default.nix index f41805748e57..a238009cd11b 100644 --- a/pkgs/applications/networking/instant-messengers/franz/default.nix +++ b/pkgs/applications/networking/instant-messengers/franz/default.nix @@ -44,7 +44,7 @@ in stdenv.mkDerivation rec { ''; installPhase = '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" Franz + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" Franz patchelf --set-rpath "$out/opt/franz:${stdenv.lib.makeLibraryPath deps}" Franz mkdir -p $out/bin $out/opt/franz diff --git a/pkgs/applications/networking/instant-messengers/hipchat/default.nix b/pkgs/applications/networking/instant-messengers/hipchat/default.nix index ccbb10c743bb..326f95630707 100644 --- a/pkgs/applications/networking/instant-messengers/hipchat/default.nix +++ b/pkgs/applications/networking/instant-messengers/hipchat/default.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation { mv usr/share $out for file in $(find $d -type f); do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $file || true + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $file || true patchelf --set-rpath ${rpath}:$out/libexec/hipchat/lib:\$ORIGIN $file || true done diff --git a/pkgs/applications/networking/instant-messengers/messenger-for-desktop/default.nix b/pkgs/applications/networking/instant-messengers/messenger-for-desktop/default.nix index 1db674f9ae13..37a3746669b1 100644 --- a/pkgs/applications/networking/instant-messengers/messenger-for-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/messenger-for-desktop/default.nix @@ -72,7 +72,7 @@ in stdenv.mkDerivation { # patch the binaries for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$file" || true + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true patchelf --set-rpath ${rpath}:$out/libexec $file || true done diff --git a/pkgs/applications/networking/instant-messengers/rambox/default.nix b/pkgs/applications/networking/instant-messengers/rambox/default.nix index b5ce53177a7f..7cb89f019e0e 100644 --- a/pkgs/applications/networking/instant-messengers/rambox/default.nix +++ b/pkgs/applications/networking/instant-messengers/rambox/default.nix @@ -44,7 +44,7 @@ in stdenv.mkDerivation rec { dontPatchELF = true; installPhase = '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" rambox + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" rambox patchelf --set-rpath "$out/opt/rambox:${stdenv.lib.makeLibraryPath deps}" rambox mkdir -p $out/bin $out/opt/rambox diff --git a/pkgs/applications/networking/instant-messengers/skypeforlinux/default.nix b/pkgs/applications/networking/instant-messengers/skypeforlinux/default.nix index f4ad5b74f602..d476b9b35c49 100644 --- a/pkgs/applications/networking/instant-messengers/skypeforlinux/default.nix +++ b/pkgs/applications/networking/instant-messengers/skypeforlinux/default.nix @@ -78,7 +78,7 @@ in stdenv.mkDerivation { postFixup = '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/share/skypeforlinux:${rpath}" "$out/share/skypeforlinux/skypeforlinux" ln -s "$out/share/skypeforlinux/skypeforlinux" "$out/bin/skypeforlinux" diff --git a/pkgs/applications/networking/instant-messengers/slack/default.nix b/pkgs/applications/networking/instant-messengers/slack/default.nix index 1d1bc86d7ccc..f36f0956f654 100644 --- a/pkgs/applications/networking/instant-messengers/slack/default.nix +++ b/pkgs/applications/networking/instant-messengers/slack/default.nix @@ -68,7 +68,7 @@ in stdenv.mkDerivation { chmod -R g-w $out for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$file" || true + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true patchelf --set-rpath ${rpath}:$out/lib/slack $file || true done diff --git a/pkgs/applications/networking/instant-messengers/teamspeak/client.nix b/pkgs/applications/networking/instant-messengers/teamspeak/client.nix index 7d1f3fa6791e..efafbd9050cd 100644 --- a/pkgs/applications/networking/instant-messengers/teamspeak/client.nix +++ b/pkgs/applications/networking/instant-messengers/teamspeak/client.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { mv ts3client_linux_${arch} ts3client echo "patching ts3client..." patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath deps}:$(cat $NIX_CC/nix-support/orig-cc)/${libDir} \ --force-rpath \ ts3client diff --git a/pkgs/applications/networking/instant-messengers/teamspeak/server.nix b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix index bfd2469c1cea..c86de07bc842 100644 --- a/pkgs/applications/networking/instant-messengers/teamspeak/server.nix +++ b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix @@ -25,13 +25,13 @@ stdenv.mkDerivation { '' echo "patching ts3server" patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \ --force-rpath \ ts3server cp tsdns/tsdnsserver tsdnsserver patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \ --force-rpath \ tsdnsserver diff --git a/pkgs/applications/networking/instant-messengers/viber/default.nix b/pkgs/applications/networking/instant-messengers/viber/default.nix index afc977ad383b..71d1bccc2b1d 100644 --- a/pkgs/applications/networking/instant-messengers/viber/default.nix +++ b/pkgs/applications/networking/instant-messengers/viber/default.nix @@ -72,7 +72,7 @@ stdenv.mkDerivation rec { chmod -R g-w $out for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$file" || true + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true patchelf --set-rpath $libPath:$out/opt/viber/lib $file || true done diff --git a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix index 208d45ed3dd1..91c77fc9d7ca 100644 --- a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix +++ b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix @@ -65,10 +65,10 @@ in stdenv.mkDerivation { mkdir -p $out/bin cp -ar * $packagePath - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $packagePath/zoom - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $packagePath/QtWebEngineProcess - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $packagePath/qtdiag - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $packagePath/zopen + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $packagePath/zoom + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $packagePath/QtWebEngineProcess + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $packagePath/qtdiag + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $packagePath/zopen # included from https://github.com/NixOS/nixpkgs/commit/fc218766333a05c9352b386e0cbb16e1ae84bf53 # it works for me without it, but, well... paxmark m $packagePath/zoom diff --git a/pkgs/applications/networking/insync/default.nix b/pkgs/applications/networking/insync/default.nix index 4a6bec5d1dab..93efdb74c083 100644 --- a/pkgs/applications/networking/insync/default.nix +++ b/pkgs/applications/networking/insync/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { buildInputs = [ makeWrapper ]; postPatch = '' - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" client/insync-portable + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" client/insync-portable ''; installPhase = '' diff --git a/pkgs/applications/networking/mailreaders/nylas-mail-bin/default.nix b/pkgs/applications/networking/mailreaders/nylas-mail-bin/default.nix index 2350b9f9465a..4c768325fee9 100644 --- a/pkgs/applications/networking/mailreaders/nylas-mail-bin/default.nix +++ b/pkgs/applications/networking/mailreaders/nylas-mail-bin/default.nix @@ -107,7 +107,7 @@ stdenv.mkDerivation rec { # Patch binaries binrp=$(patchelf --print-rpath $out/share/nylas-mail/nylas) - patchelf --interpreter $(cat "$NIX_BINUTILS/nix-support/dynamic-linker") \ + patchelf --interpreter $(cat "$NIX_CC"/nix-support/dynamic-linker) \ --set-rpath $binrp:$out/lib:${stdenv.cc.cc.lib}/lib:${lib.makeLibraryPath propagatedBuildInputs } \ $out/share/nylas-mail/nylas @@ -119,7 +119,7 @@ stdenv.mkDerivation rec { wrapProgram $out/share/nylas-mail/resources/apm/bin/apm \ --set PATH "${coreutils}/bin" - patchelf --interpreter $(cat "$NIX_BINUTILS/nix-support/dynamic-linker") \ + patchelf --interpreter $(cat "$NIX_CC"/nix-support/dynamic-linker) \ --set-rpath ${gcc-unwrapped.lib}/lib $out/share/nylas-mail/resources/apm/bin/node ''; diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix index 8a4eb4991ad3..4f714cabf79b 100644 --- a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix +++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix @@ -134,7 +134,7 @@ stdenv.mkDerivation { for executable in \ thunderbird crashreporter thunderbird-bin plugin-container updater do - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ "$out/usr/lib/thunderbird-bin-${version}/$executable" done diff --git a/pkgs/applications/networking/remote/anydesk/default.nix b/pkgs/applications/networking/remote/anydesk/default.nix index 93cb7c82b619..a6858a7b5fdf 100644 --- a/pkgs/applications/networking/remote/anydesk/default.nix +++ b/pkgs/applications/networking/remote/anydesk/default.nix @@ -41,7 +41,7 @@ in stdenv.mkDerivation rec { postFixup = '' patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "${libPath}" \ $out/bin/anydesk diff --git a/pkgs/applications/networking/remote/citrix-receiver/default.nix b/pkgs/applications/networking/remote/citrix-receiver/default.nix index f6c7285e3b71..c656ff24df84 100644 --- a/pkgs/applications/networking/remote/citrix-receiver/default.nix +++ b/pkgs/applications/networking/remote/citrix-receiver/default.nix @@ -131,7 +131,7 @@ in stdenv.mkDerivation rec { echo "Patching ELF intrepreter and rpath for $f" chmod u+w "$f" patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$ICAInstDir:$libPath" "$f" done diff --git a/pkgs/applications/networking/resilio-sync/default.nix b/pkgs/applications/networking/resilio-sync/default.nix index 6df757626f84..7622cb76ad2a 100644 --- a/pkgs/applications/networking/resilio-sync/default.nix +++ b/pkgs/applications/networking/resilio-sync/default.nix @@ -25,7 +25,7 @@ in stdenv.mkDerivation rec { installPhase = '' install -D rslsync "$out/bin/rslsync" patchelf \ - --interpreter "$(< $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(< $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath} "$out/bin/rslsync" ''; diff --git a/pkgs/applications/office/marp/default.nix b/pkgs/applications/office/marp/default.nix index 124efb139464..0e53d58a083b 100644 --- a/pkgs/applications/office/marp/default.nix +++ b/pkgs/applications/office/marp/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { ''; postFixup = '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${atomEnv.libPath}:${stdenv.lib.makeLibraryPath [ libXScrnSaver ]}:$out/lib/marp" \ $out/bin/Marp ''; diff --git a/pkgs/applications/office/moneyplex/default.nix b/pkgs/applications/office/moneyplex/default.nix index 279a406327b3..4530305ee12e 100644 --- a/pkgs/applications/office/moneyplex/default.nix +++ b/pkgs/applications/office/moneyplex/default.nix @@ -78,9 +78,9 @@ stdenv.mkDerivation rec { ${coreutils}/bin/cp "\$MDIR/moneyplex" "\$MDIR/moneyplex.patched" ${coreutils}/bin/chmod 0755 "\$MDIR/moneyplex.patched" fi - if [ ! \`${patchelf}/bin/patchelf --print-interpreter \$MDIR/moneyplex.patched\` = $(cat $NIX_BINUTILS/nix-support/dynamic-linker) ] || + if [ ! \`${patchelf}/bin/patchelf --print-interpreter \$MDIR/moneyplex.patched\` = $(cat $NIX_CC/nix-support/dynamic-linker) ] || [ ! \`${patchelf}/bin/patchelf --print-rpath \$MDIR/moneyplex.patched\` = "${libPath}" ]; then - ${patchelf}/bin/patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) --set-rpath "${libPath}" "\$MDIR/moneyplex.patched" + ${patchelf}/bin/patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${libPath}" "\$MDIR/moneyplex.patched" fi exec \$MDIR/moneyplex.patched diff --git a/pkgs/applications/office/wpsoffice/default.nix b/pkgs/applications/office/wpsoffice/default.nix index 85deae9ec02b..41dd8595c30d 100644 --- a/pkgs/applications/office/wpsoffice/default.nix +++ b/pkgs/applications/office/wpsoffice/default.nix @@ -53,7 +53,7 @@ in stdenv.mkDerivation rec{ mkdir $out/bin for i in wps wpp et; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --force-rpath --set-rpath "$prefix/office6:$libPath" \ $prefix/office6/$i diff --git a/pkgs/applications/science/electronics/eagle/default.nix b/pkgs/applications/science/electronics/eagle/default.nix index 9ac4cc820398..edc5845e9887 100644 --- a/pkgs/applications/science/electronics/eagle/default.nix +++ b/pkgs/applications/science/electronics/eagle/default.nix @@ -69,7 +69,7 @@ stdenv.mkDerivation rec { gcc -shared -fPIC -DEAGLE_PATH=\"$out/eagle-${version}\" ${./eagle_fixer.c} -o "$out"/lib/eagle_fixer.so -ldl # Make wrapper script - dynlinker="$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" + dynlinker="$(cat $NIX_CC/nix-support/dynamic-linker)" mkdir -p "$out"/bin cat > "$out"/bin/eagle << EOF #!${stdenv.shell} diff --git a/pkgs/applications/science/logic/saw-tools/default.nix b/pkgs/applications/science/logic/saw-tools/default.nix index e2c3e1fdc00c..949b34420b79 100644 --- a/pkgs/applications/science/logic/saw-tools/default.nix +++ b/pkgs/applications/science/logic/saw-tools/default.nix @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { fixupPhase = '' for x in bin/bcdump bin/extcore-info bin/jss bin/llvm-disasm bin/lss bin/saw; do - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/lib:${libPath}" $out/$x; done ''; diff --git a/pkgs/applications/science/logic/tptp/default.nix b/pkgs/applications/science/logic/tptp/default.nix index 2ad991e00e39..db7e0c0c9382 100644 --- a/pkgs/applications/science/logic/tptp/default.nix +++ b/pkgs/applications/science/logic/tptp/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { substituteInPlace $sharedir/TPTP2X/tptp2X_install --replace /bin/mv mv tcsh $sharedir/TPTP2X/tptp2X_install -default - patchelf --interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $sharedir/Scripts/tptp4X + patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $sharedir/Scripts/tptp4X mkdir -p $out/bin ln -s $sharedir/TPTP2X/tptp2X $out/bin diff --git a/pkgs/applications/science/logic/verifast/default.nix b/pkgs/applications/science/logic/verifast/default.nix index 3ee3f8b7decf..ada586fc4e6d 100644 --- a/pkgs/applications/science/logic/verifast/default.nix +++ b/pkgs/applications/science/logic/verifast/default.nix @@ -10,7 +10,7 @@ let ] + ":${stdenv.cc.cc.lib}/lib64"; patchExe = x: '' - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${libPath} ${x} ''; in diff --git a/pkgs/applications/science/math/mathematica/10.nix b/pkgs/applications/science/math/mathematica/10.nix index 005c1c496094..6a49976c86b8 100644 --- a/pkgs/applications/science/math/mathematica/10.nix +++ b/pkgs/applications/science/math/mathematica/10.nix @@ -106,7 +106,7 @@ stdenv.mkDerivation rec { echo "patching $f executable <<" patchelf --shrink-rpath "$f" patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \ "$f" \ && patchelf --shrink-rpath "$f" \ diff --git a/pkgs/applications/science/math/mathematica/9.nix b/pkgs/applications/science/math/mathematica/9.nix index e190d8fde7f9..c4fd0c384c14 100644 --- a/pkgs/applications/science/math/mathematica/9.nix +++ b/pkgs/applications/science/math/mathematica/9.nix @@ -93,7 +93,7 @@ stdenv.mkDerivation rec { elif [ "$type" == "EXEC" ]; then echo "patching $f executable <<" patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${ldpath}" \ "$f" patchelf --shrink-rpath "$f" diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix index 89701991e580..1e23cfea27fc 100644 --- a/pkgs/applications/science/math/mathematica/default.nix +++ b/pkgs/applications/science/math/mathematica/default.nix @@ -114,7 +114,7 @@ stdenv.mkDerivation rec { echo "patching $f executable <<" patchelf --shrink-rpath "$f" patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \ "$f" \ && patchelf --shrink-rpath "$f" \ diff --git a/pkgs/applications/science/math/scilab-bin/default.nix b/pkgs/applications/science/math/scilab-bin/default.nix index de6868698a70..f6e255ee46e4 100644 --- a/pkgs/applications/science/math/scilab-bin/default.nix +++ b/pkgs/applications/science/math/scilab-bin/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { fullLibPath="$sci/lib/scilab:$sci/lib/thirdparty:$libPath" fullLibPath="$fullLibPath:$sci/lib/thirdparty/redist" - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$fullLibPath" bin/scilab-bin find . -name '*.so' -type f | while read file; do patchelf --set-rpath "$fullLibPath" "$file" 2>/dev/null diff --git a/pkgs/applications/science/medicine/aliza/default.nix b/pkgs/applications/science/medicine/aliza/default.nix index 74aefc26fc49..b0471b80e2f1 100644 --- a/pkgs/applications/science/medicine/aliza/default.nix +++ b/pkgs/applications/science/medicine/aliza/default.nix @@ -29,11 +29,11 @@ stdenv.mkDerivation { libs = stdenv.lib.makeLibraryPath [ qt4 zlib stdenv.cc.cc libSM libICE libX11 libXext libXt mesa ]; in '' ${patchelf}/bin/patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/aliza ${patchelf}/bin/patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/aliza-vtkvol wrapProgram $out/bin/aliza \ diff --git a/pkgs/applications/science/programming/fdr/default.nix b/pkgs/applications/science/programming/fdr/default.nix index ce48dd6fce7d..8ed8e0e73b00 100644 --- a/pkgs/applications/science/programming/fdr/default.nix +++ b/pkgs/applications/science/programming/fdr/default.nix @@ -33,7 +33,7 @@ stdenv.mkDerivation { for b in fdr4 _fdr4 refines _refines cspmprofiler cspmexplorerprof do - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$libPath:$out/lib" \ "$out/bin/$b" done diff --git a/pkgs/applications/taxes/aangifte-2006/builder.sh b/pkgs/applications/taxes/aangifte-2006/builder.sh index aab55608ba5f..1b709b613bd4 100644 --- a/pkgs/applications/taxes/aangifte-2006/builder.sh +++ b/pkgs/applications/taxes/aangifte-2006/builder.sh @@ -3,7 +3,7 @@ source $stdenv/setup buildPhase() { for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libX11/lib:$libXext/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2007/builder.sh b/pkgs/applications/taxes/aangifte-2007/builder.sh index f35bf307fbe1..79e5b3097696 100644 --- a/pkgs/applications/taxes/aangifte-2007/builder.sh +++ b/pkgs/applications/taxes/aangifte-2007/builder.sh @@ -5,7 +5,7 @@ echo $NIX_CC buildPhase() { for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libX11/lib:$libXext/lib:$libSM/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2008/builder.sh b/pkgs/applications/taxes/aangifte-2008/builder.sh index f35bf307fbe1..79e5b3097696 100644 --- a/pkgs/applications/taxes/aangifte-2008/builder.sh +++ b/pkgs/applications/taxes/aangifte-2008/builder.sh @@ -5,7 +5,7 @@ echo $NIX_CC buildPhase() { for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libX11/lib:$libXext/lib:$libSM/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2009/default.nix b/pkgs/applications/taxes/aangifte-2009/default.nix index bad9be357532..c944fc3d68b3 100644 --- a/pkgs/applications/taxes/aangifte-2009/default.nix +++ b/pkgs/applications/taxes/aangifte-2009/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2010/default.nix b/pkgs/applications/taxes/aangifte-2010/default.nix index fc2758adff26..b5a85415c376 100644 --- a/pkgs/applications/taxes/aangifte-2010/default.nix +++ b/pkgs/applications/taxes/aangifte-2010/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2011/default.nix b/pkgs/applications/taxes/aangifte-2011/default.nix index b45c99f67051..a38bc4254bbe 100644 --- a/pkgs/applications/taxes/aangifte-2011/default.nix +++ b/pkgs/applications/taxes/aangifte-2011/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2012/default.nix b/pkgs/applications/taxes/aangifte-2012/default.nix index 9fb42d7b9930..2e51ef9ed4cf 100644 --- a/pkgs/applications/taxes/aangifte-2012/default.nix +++ b/pkgs/applications/taxes/aangifte-2012/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2013-wa/default.nix b/pkgs/applications/taxes/aangifte-2013-wa/default.nix index 8b97233c8791..5ee0edb4b5e5 100644 --- a/pkgs/applications/taxes/aangifte-2013-wa/default.nix +++ b/pkgs/applications/taxes/aangifte-2013-wa/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2013/default.nix b/pkgs/applications/taxes/aangifte-2013/default.nix index 54cb86885908..3cf85961a9bb 100644 --- a/pkgs/applications/taxes/aangifte-2013/default.nix +++ b/pkgs/applications/taxes/aangifte-2013/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2014-wa/default.nix b/pkgs/applications/taxes/aangifte-2014-wa/default.nix index 6a0023d756cc..78bb8214257f 100644 --- a/pkgs/applications/taxes/aangifte-2014-wa/default.nix +++ b/pkgs/applications/taxes/aangifte-2014-wa/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/taxes/aangifte-2014/default.nix b/pkgs/applications/taxes/aangifte-2014/default.nix index 697e0cd3561f..0151cca52b2c 100644 --- a/pkgs/applications/taxes/aangifte-2014/default.nix +++ b/pkgs/applications/taxes/aangifte-2014/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' for i in bin/*; do patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_CC/nix-support/orig-cc)/lib \ $i done diff --git a/pkgs/applications/version-management/gitkraken/default.nix b/pkgs/applications/version-management/gitkraken/default.nix index 0d410d230d4d..c7f7a4b02e4d 100644 --- a/pkgs/applications/version-management/gitkraken/default.nix +++ b/pkgs/applications/version-management/gitkraken/default.nix @@ -80,7 +80,7 @@ stdenv.mkDerivation rec { ''; postFixup = '' - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$libPath:$out/opt/gitkraken" "$out/opt/gitkraken/gitkraken" wrapProgram $out/opt/gitkraken/gitkraken \ --prefix LD_PRELOAD : "${makeLibraryPath [ curl ]}/libcurl.so.4" \ diff --git a/pkgs/applications/video/makemkv/builder.sh b/pkgs/applications/video/makemkv/builder.sh index ee2dd392bb78..416d5c0f0b07 100644 --- a/pkgs/applications/video/makemkv/builder.sh +++ b/pkgs/applications/video/makemkv/builder.sh @@ -27,7 +27,7 @@ libPath="${libPath}:${out}/lib" # XXX: der. This should be in the nix file? for i in ${bin} ; do patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath \ ${i} done diff --git a/pkgs/build-support/binutils-wrapper/add-flags.sh b/pkgs/build-support/binutils-wrapper/add-flags.sh deleted file mode 100644 index a69e2313af3b..000000000000 --- a/pkgs/build-support/binutils-wrapper/add-flags.sh +++ /dev/null @@ -1,40 +0,0 @@ -# See cc-wrapper for comments. -var_templates_list=( - NIX+IGNORE_LD_THROUGH_GCC - NIX+LDFLAGS - NIX+LDFLAGS_BEFORE - NIX+LDFLAGS_AFTER - NIX+LDFLAGS_HARDEN -) -var_templates_bool=( - NIX+SET_BUILD_ID - NIX+DONT_SET_RPATH -) - -declare -a role_infixes=() -if [ "${NIX_BINUTILS_WRAPPER_@infixSalt@_TARGET_BUILD:-}" ]; then - role_infixes+=(_BUILD_) -fi -if [ "${NIX_BINUTILS_WRAPPER_@infixSalt@_TARGET_HOST:-}" ]; then - role_infixes+=(_) -fi -if [ "${NIX_BINUTILS_WRAPPER_@infixSalt@_TARGET_TARGET:-}" ]; then - role_infixes+=(_TARGET_) -fi - -for var in "${var_templates_list[@]}"; do - mangleVarList "$var" "${role_infixes[@]}" -done -for var in "${var_templates_bool[@]}"; do - mangleVarBool "$var" "${role_infixes[@]}" -done - -if [ -e @out@/nix-support/libc-ldflags ]; then - NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)" -fi - -if [ -e @out@/nix-support/libc-ldflags-before ]; then - NIX_@infixSalt@_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_@infixSalt@_LDFLAGS_BEFORE" -fi - -export NIX_BINUTILS_WRAPPER_@infixSalt@_FLAGS_SET=1 diff --git a/pkgs/build-support/binutils-wrapper/add-hardening.sh b/pkgs/build-support/binutils-wrapper/add-hardening.sh deleted file mode 100644 index 6dabc2007bc9..000000000000 --- a/pkgs/build-support/binutils-wrapper/add-hardening.sh +++ /dev/null @@ -1,53 +0,0 @@ -hardeningFlags=(relro bindnow) -# Intentionally word-split in case 'hardeningEnable' is defined in -# Nix. Also, our bootstrap tools version of bash is old enough that -# undefined arrays trip `set -u`. -if [[ -v hardeningEnable[@] ]]; then - hardeningFlags+=(${hardeningEnable[@]}) -fi -hardeningLDFlags=() - -declare -A hardeningDisableMap - -# Intentionally word-split in case 'hardeningDisable' is defined in Nix. -for flag in ${hardeningDisable[@]:-IGNORED_KEY} @hardening_unsupported_flags@ -do - hardeningDisableMap[$flag]=1 -done - -if [[ -n "${NIX_DEBUG:-}" ]]; then - printf 'HARDENING: disabled flags:' >&2 - (( "${#hardeningDisableMap[@]}" )) && printf ' %q' "${!hardeningDisableMap[@]}" >&2 - echo >&2 -fi - -if [[ -z "${hardeningDisableMap[all]:-}" ]]; then - if [[ -n "${NIX_DEBUG:-}" ]]; then - echo 'HARDENING: Is active (not completely disabled with "all" flag)' >&2; - fi - for flag in "${hardeningFlags[@]}" - do - if [[ -z "${hardeningDisableMap[$flag]:-}" ]]; then - case $flag in - pie) - if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then - if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling LDFlags -pie >&2; fi - hardeningLDFlags+=('-pie') - fi - ;; - relro) - if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling relro >&2; fi - hardeningLDFlags+=('-z' 'relro') - ;; - bindnow) - if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling bindnow >&2; fi - hardeningLDFlags+=('-z' 'now') - ;; - *) - # Ignore unsupported. Checked in Nix that at least *some* - # tool supports each flag. - ;; - esac - fi - done -fi diff --git a/pkgs/build-support/binutils-wrapper/default.nix b/pkgs/build-support/binutils-wrapper/default.nix deleted file mode 100644 index 7e255cdb2eb1..000000000000 --- a/pkgs/build-support/binutils-wrapper/default.nix +++ /dev/null @@ -1,288 +0,0 @@ -# The Nixpkgs CC is not directly usable, since it doesn't know where -# the C library and standard header files are. Therefore the compiler -# produced by that package cannot be installed directly in a user -# environment and used from the command line. So we use a wrapper -# script that sets up the right environment variables so that the -# compiler and the linker just "work". - -{ name ? "", stdenv, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" -, binutils ? null, libc ? null -, coreutils ? null, shell ? stdenv.shell, gnugrep ? null -, extraPackages ? [], extraBuildCommands ? "" -, buildPackages ? {} -, useMacosReexportHack ? false -}: - -with stdenv.lib; - -assert nativeTools -> nativePrefix != ""; -assert !nativeTools -> - binutils != null && coreutils != null && gnugrep != null; -assert !(nativeLibc && noLibc); -assert (noLibc || nativeLibc) == (libc == null); - -let - inherit (stdenv) hostPlatform targetPlatform; - - # Prefix for binaries. Customarily ends with a dash separator. - # - # TODO(@Ericson2314) Make unconditional, or optional but always true by - # default. - prefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) - (targetPlatform.config + "-"); - - binutilsVersion = (builtins.parseDrvName binutils.name).version; - binutilsName = (builtins.parseDrvName binutils.name).name; - - libc_bin = if libc == null then null else getBin libc; - libc_dev = if libc == null then null else getDev libc; - libc_lib = if libc == null then null else getLib libc; - binutils_bin = if nativeTools then "" else getBin binutils; - # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; - - dashlessTarget = stdenv.lib.replaceStrings ["-"] ["_"] targetPlatform.config; - - # See description in cc-wrapper. - infixSalt = dashlessTarget; - - # The dynamic linker has different names on different platforms. This is a - # shell glob that ought to match it. - dynamicLinker = - /**/ if libc == null then null - else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" - else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" - # ARM with a wildcard, which can be "" or "-armhf". - else if targetPlatform.isArm then "${libc_lib}/lib/ld-linux*.so.3" - else if targetPlatform.system == "aarch64-linux" then "${libc_lib}/lib/ld-linux-aarch64.so.1" - else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1" - else if targetPlatform.system == "mips64el-linux" then "${libc_lib}/lib/ld.so.1" - else if targetPlatform.system == "x86_64-darwin" then "/usr/lib/dyld" - else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" - else null; - - expand-response-params = - if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null" - then import ../expand-response-params { inherit (buildPackages) stdenv; } - else ""; - -in - -stdenv.mkDerivation { - name = prefix - + (if name != "" then name else "${binutilsName}-wrapper") - + (stdenv.lib.optionalString (binutils != null && binutilsVersion != "") "-${binutilsVersion}"); - - preferLocalBuild = true; - - inherit binutils_bin shell libc_bin libc_dev libc_lib coreutils_bin; - gnugrep_bin = if nativeTools then "" else gnugrep; - - binPrefix = prefix; - inherit infixSalt; - - outputs = [ "out" "man" ]; - - passthru = { - inherit binutils libc nativeTools nativeLibc nativePrefix prefix; - - emacsBufferSetup = pkgs: '' - ; We should handle propagation here too - (mapc - (lambda (arg) - (when (file-directory-p (concat arg "/lib")) - (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib"))) - (when (file-directory-p (concat arg "/lib64")) - (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib64")))) - '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) - ''; - }; - - dontBuild = true; - dontConfigure = true; - - unpackPhase = '' - src=$PWD - ''; - - installPhase = - '' - set -u - - mkdir -p $out/bin $out/nix-support $man/nix-support - - wrap() { - local dst="$1" - local wrapper="$2" - export prog="$3" - set +u - substituteAll "$wrapper" "$out/bin/$dst" - set -u - chmod +x "$out/bin/$dst" - } - '' - - + (if nativeTools then '' - echo ${nativePrefix} > $out/nix-support/orig-binutils - - ldPath="${nativePrefix}/bin" - '' else '' - echo $binutils_bin > $out/nix-support/orig-binutils - - ldPath="${binutils_bin}/bin" - '' - - + optionalString (targetPlatform.isSunOS && nativePrefix != "") '' - # Solaris needs an additional ld wrapper. - ldPath="${nativePrefix}/bin" - exec="$ldPath/${prefix}ld" - wrap ld-solaris ${./ld-solaris-wrapper.sh} - '') - - + '' - # Create a symlink to as (the assembler). - if [ -e $ldPath/${prefix}as ]; then - ln -s $ldPath/${prefix}as $out/bin/${prefix}as - fi - - '' + (if !useMacosReexportHack then '' - wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld} - '' else '' - ldInner="${prefix}ld-reexport-delegate" - wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld} - wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner" - unset ldInner - '') + '' - - if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then - wrap ${prefix}ld.gold ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.gold - fi - - if [ -e ${binutils_bin}/bin/ld.bfd ]; then - wrap ${prefix}ld.bfd ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd - fi - - set +u - ''; - - propagatedBuildInputs = extraPackages; - - setupHook = ./setup-hook.sh; - - postFixup = - '' - set -u - '' - - + optionalString (libc != null) ('' - ## - ## General libc support - ## - - echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags - - echo "${libc_lib}" > $out/nix-support/orig-libc - echo "${libc_dev}" > $out/nix-support/orig-libc-dev - - ## - ## Dynamic linker support - ## - - if [[ -z ''${dynamicLinker+x} ]]; then - echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2 - local dynamicLinker="${libc_lib}/lib/ld*.so.?" - fi - - # Expand globs to fill array of options - dynamicLinker=($dynamicLinker) - - case ''${#dynamicLinker[@]} in - 0) echo "No dynamic linker found for platform '${targetPlatform.config}'." >&2;; - 1) echo "Using dynamic linker: '$dynamicLinker'" >&2;; - *) echo "Multiple dynamic linkers found for platform '${targetPlatform.config}'." >&2;; - esac - - if [ -n "$dynamicLinker" ]; then - echo $dynamicLinker > $out/nix-support/dynamic-linker - - '' + (if targetPlatform.isDarwin then '' - printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook - '' else '' - if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then - echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 - fi - - local ldflagsBefore=(-dynamic-linker "$dynamicLinker") - '') + '' - fi - - # The dynamic linker is passed in `ldflagsBefore' to allow - # explicit overrides of the dynamic linker by callers to ld - # (the *last* value counts, so ours should come first). - printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before - '') - - + optionalString (!nativeTools) '' - - ## - ## User env support - ## - - # Propagate the underling unwrapped binutils so that if you - # install the wrapper, you get tools like objdump, the manpages, - # etc. as well (same for any binaries of libc). - printWords ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages - '' - - + '' - - ## - ## Hardening support - ## - - # some linkers on some platforms don't support specific -z flags - export hardening_unsupported_flags="" - if [[ "$($ldPath/${prefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then - hardening_unsupported_flags+=" bindnow" - fi - if [[ "$($ldPath/${prefix}ld -z relro 2>&1 || true)" =~ un(recognized|known)\ option ]]; then - hardening_unsupported_flags+=" relro" - fi - '' - - + optionalString hostPlatform.isCygwin '' - hardening_unsupported_flags+=" pic" - '' - - + '' - set +u - substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh - substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh - substituteAll ${../cc-wrapper/utils.sh} $out/nix-support/utils.sh - - ## - ## Extra custom steps - ## - - '' - + extraBuildCommands; - - inherit dynamicLinker expand-response-params; - - # for substitution in utils.sh - expandResponseParams = "${expand-response-params}/bin/expand-response-params"; - - crossAttrs = { - shell = shell.crossDrv + shell.crossDrv.shellPath; - }; - - meta = - let binutils_ = if binutils != null then binutils else {}; in - (if binutils_ ? meta then removeAttrs binutils.meta ["priority"] else {}) // - { description = - stdenv.lib.attrByPath ["meta" "description"] "System binary utilities" binutils_ - + " (wrapper script)"; - } // optionalAttrs useMacosReexportHack { - platforms = stdenv.lib.platforms.darwin; - }; -} diff --git a/pkgs/build-support/binutils-wrapper/setup-hook.sh b/pkgs/build-support/binutils-wrapper/setup-hook.sh deleted file mode 100644 index 3395ddd33919..000000000000 --- a/pkgs/build-support/binutils-wrapper/setup-hook.sh +++ /dev/null @@ -1,63 +0,0 @@ -# Binutils Wrapper hygiene -# -# See comments in cc-wrapper's setup hook. This works exactly the same way. - -binutilsWrapper_addLDVars () { - case $depOffset in - -1) local role='BUILD_' ;; - 0) local role='' ;; - 1) local role='TARGET_' ;; - *) echo "binutils-wrapper: Error: Cannot be used with $depOffset-offset deps, " >2; - return 1 ;; - esac - - if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then - export NIX_${role}LDFLAGS+=" -L$1/lib64" - fi - - if [[ -d "$1/lib" ]]; then - export NIX_${role}LDFLAGS+=" -L$1/lib" - fi -} - -if [ -n "${crossConfig:-}" ]; then - export NIX_BINUTILS_WRAPPER_@infixSalt@_TARGET_BUILD=1 - role="BUILD_" -else - export NIX_BINUTILS_WRAPPER_@infixSalt@_TARGET_HOST=1 - role="" -fi - -envHooks+=(binutilsWrapper_addLDVars) - -# shellcheck disable=SC2157 -if [ -n "@binutils_bin@" ]; then - addToSearchPath _PATH @binutils_bin@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@libc_bin@" ]; then - addToSearchPath _PATH @libc_bin@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@coreutils_bin@" ]; then - addToSearchPath _PATH @coreutils_bin@/bin -fi - -# Export tool environment variables so various build systems use the right ones. - -export NIX_${role}BINUTILS=@out@ - -for CMD in \ - ar as nm objcopy ranlib strip strings size ld windres -do - if - PATH=$_PATH type -p "@binPrefix@$CMD" > /dev/null - then - export "${role}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@binPrefix@${CMD}"; - fi -done - -# No local scope in sourced file -unset role diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index fb6e38302a5d..39633fce69a8 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -4,14 +4,19 @@ # that case, it is cheaper/better to not repeat this step and let the forked # wrapped binary just inherit the work of the forker's wrapper script. -var_templates_list=( +var_templates=( NIX+CFLAGS_COMPILE NIX+CFLAGS_LINK NIX+CXXSTDLIB_COMPILE NIX+CXXSTDLIB_LINK NIX+GNATFLAGS_COMPILE -) -var_templates_bool=( + NIX+IGNORE_LD_THROUGH_GCC + NIX+LDFLAGS + NIX+LDFLAGS_BEFORE + NIX+LDFLAGS_AFTER + + NIX+SET_BUILD_ID + NIX+DONT_SET_RPATH NIX+ENFORCE_NO_NATIVE ) @@ -30,11 +35,17 @@ fi # We need to mangle names for hygiene, but also take parameters/overrides # from the environment. -for var in "${var_templates_list[@]}"; do - mangleVarList "$var" "${role_infixes[@]}" -done -for var in "${var_templates_bool[@]}"; do - mangleVarBool "$var" "${role_infixes[@]}" +for var in "${var_templates[@]}"; do + outputVar="${var/+/_@infixSalt@_}" + export ${outputVar}+='' + # For each role we serve, we accumulate the input parameters into our own + # cc-wrapper-derivation-specific environment variables. + for infix in "${role_infixes[@]}"; do + inputVar="${var/+/${infix}}" + if [ -v "$inputVar" ]; then + export ${outputVar}+="${!outputVar:+ }${!inputVar}" + fi + done done # `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld. @@ -55,13 +66,17 @@ if [ -e @out@/nix-support/gnat-cflags ]; then NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE" fi +if [ -e @out@/nix-support/libc-ldflags ]; then + NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)" +fi + if [ -e @out@/nix-support/cc-ldflags ]; then - # We don't import this above, but just tack this on know. binutils-wrapper's - # add-flags will not clobber it. - # - # TODO(@Ericson2314): Consider `NIX_@infixSalt@_CFLAGS_LINK` instead NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" fi +if [ -e @out@/nix-support/libc-ldflags-before ]; then + NIX_@infixSalt@_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_@infixSalt@_LDFLAGS_BEFORE" +fi + # That way forked processes will not extend these environment variables again. export NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET=1 diff --git a/pkgs/build-support/cc-wrapper/add-hardening.sh b/pkgs/build-support/cc-wrapper/add-hardening.sh index 3983e866ee1f..34358e04194a 100644 --- a/pkgs/build-support/cc-wrapper/add-hardening.sh +++ b/pkgs/build-support/cc-wrapper/add-hardening.sh @@ -6,6 +6,7 @@ if [[ -v hardeningEnable[@] ]]; then hardeningFlags+=(${hardeningEnable[@]}) fi hardeningCFlags=() +hardeningLDFlags=() declare -A hardeningDisableMap @@ -43,6 +44,7 @@ if [[ -z "${hardeningDisableMap[all]:-}" ]]; then if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling LDFlags -pie >&2; fi hardeningCFlags+=('-pie') + hardeningLDFlags+=('-pie') fi ;; pic) @@ -57,6 +59,14 @@ if [[ -z "${hardeningDisableMap[all]:-}" ]]; then if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling format >&2; fi hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security') ;; + relro) + if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling relro >&2; fi + hardeningLDFlags+=('-z' 'relro') + ;; + bindnow) + if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling bindnow >&2; fi + hardeningLDFlags+=('-z' 'now') + ;; *) # Ignore unsupported. Checked in Nix that at least *some* # tool supports each flag. diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 524e53098476..aacaf196f313 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -11,18 +11,12 @@ if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin" fi -source @out@/nix-support/utils.sh - -# Flirting with a layer violation here. -if [ -z "${NIX_BINUTILS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then - source @binutils@/nix-support/add-flags.sh -fi - -# Put this one second so libc ldflags take priority. if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then source @out@/nix-support/add-flags.sh fi +source @out@/nix-support/utils.sh + # Parse command line options and set several variables. # For instance, figure out if linker flags should be passed. @@ -63,6 +57,10 @@ while (( "$n" < "$nParams" )); do cppInclude=0 elif [ "${p:0:1}" != - ]; then nonFlagArgs=1 + elif [ "$p" = -m32 ]; then + if [ -e @out@/nix-support/dynamic-linker-m32 ]; then + NIX_@infixSalt@_LDFLAGS+=" -dynamic-linker $(< @out@/nix-support/dynamic-linker-m32)" + fi fi n+=1 done diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 30520290086c..0114170b8ebc 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -6,20 +6,23 @@ # compiler and the linker just "work". { name ? "", stdenv, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" -, cc ? null, libc ? null, binutils, coreutils ? null, shell ? stdenv.shell +, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell , zlib ? null, extraPackages ? [], extraBuildCommands ? "" , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} +, useMacosReexportHack ? false }: with stdenv.lib; assert nativeTools -> nativePrefix != ""; assert !nativeTools -> - cc != null && coreutils != null && gnugrep != null; + cc != null && binutils != null && coreutils != null && gnugrep != null; assert !(nativeLibc && noLibc); assert (noLibc || nativeLibc) == (libc == null); +assert stdenv.targetPlatform != stdenv.hostPlatform -> runCommand != null; + # For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper. assert cc.langVhdl or false -> zlib != null; @@ -40,6 +43,7 @@ let libc_dev = if libc == null then null else getDev libc; libc_lib = if libc == null then null else getLib libc; cc_solib = getLib cc; + binutils_bin = if nativeTools then "" else getBin binutils; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. coreutils_bin = if nativeTools then "" else getBin coreutils; @@ -55,6 +59,21 @@ let # unstable implementation detail, however. infixSalt = dashlessTarget; + # The dynamic linker has different names on different platforms. This is a + # shell glob that ought to match it. + dynamicLinker = + /**/ if libc == null then null + else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" + else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" + # ARM with a wildcard, which can be "" or "-armhf". + else if targetPlatform.isArm then "${libc_lib}/lib/ld-linux*.so.3" + else if targetPlatform.system == "aarch64-linux" then "${libc_lib}/lib/ld-linux-aarch64.so.1" + else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1" + else if targetPlatform.system == "mips64el-linux" then "${libc_lib}/lib/ld.so.1" + else if targetPlatform.system == "x86_64-darwin" then "/usr/lib/dyld" + else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" + else null; + expand-response-params = if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null" then import ../expand-response-params { inherit (buildPackages) stdenv; } @@ -69,7 +88,7 @@ stdenv.mkDerivation { preferLocalBuild = true; - inherit cc shell libc_bin libc_dev libc_lib binutils coreutils_bin; + inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin; gnugrep_bin = if nativeTools then "" else gnugrep; binPrefix = prefix; @@ -83,11 +102,13 @@ stdenv.mkDerivation { emacsBufferSetup = pkgs: '' ; We should handle propagation here too - (mapc - (lambda (arg) - (when (file-directory-p (concat arg "/include")) - (setenv "NIX_${infixSalt}_CFLAGS_COMPILE" (concat (getenv "NIX_${infixSalt}_CFLAGS_COMPILE") " -isystem " arg "/include")))) - '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) + (mapc (lambda (arg) + (when (file-directory-p (concat arg "/include")) + (setenv "NIX_${infixSalt}_CFLAGS_COMPILE" (concat (getenv "NIX_${infixSalt}_CFLAGS_COMPILE") " -isystem " arg "/include"))) + (when (file-directory-p (concat arg "/lib")) + (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib"))) + (when (file-directory-p (concat arg "/lib64")) + (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib64")))) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) ''; }; @@ -117,18 +138,45 @@ stdenv.mkDerivation { echo ${if targetPlatform.isDarwin then cc else nativePrefix} > $out/nix-support/orig-cc ccPath="${if targetPlatform.isDarwin then cc else nativePrefix}/bin" + ldPath="${nativePrefix}/bin" '' else '' echo $cc > $out/nix-support/orig-cc ccPath="${cc}/bin" + ldPath="${binutils_bin}/bin" + '' + + + optionalString (targetPlatform.isSunOS && nativePrefix != "") '' + # Solaris needs an additional ld wrapper. + ldPath="${nativePrefix}/bin" + exec="$ldPath/${prefix}ld" + wrap ld-solaris ${./ld-solaris-wrapper.sh} '') + '' - # Create symlinks to everything in the binutils wrapper. - for bbin in $binutils/bin/*; do - mkdir -p "$out/bin" - ln -s "$bbin" "$out/bin/$(basename $bbin)" - done + # Create a symlink to as (the assembler). This is useful when a + # cc-wrapper is installed in a user environment, as it ensures that + # the right assembler is called. + if [ -e $ldPath/${prefix}as ]; then + ln -s $ldPath/${prefix}as $out/bin/${prefix}as + fi + + '' + (if !useMacosReexportHack then '' + wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld} + '' else '' + ldInner="${prefix}ld-reexport-delegate" + wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld} + wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner" + unset ldInner + '') + '' + + if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then + wrap ${prefix}ld.gold ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.gold + fi + + if [ -e ${binutils_bin}/bin/ld.bfd ]; then + wrap ${prefix}ld.bfd ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd + fi # We export environment variables pointing to the wrapped nonstandard # cmds, lest some lousy configure script use those to guess compiler @@ -188,7 +236,7 @@ stdenv.mkDerivation { ln -s $ccPath/${prefix}ghdl $out/bin/${prefix}ghdl ''; - propagatedBuildInputs = [ binutils ] ++ extraPackages; + propagatedBuildInputs = extraPackages; setupHook = ./setup-hook.sh; @@ -197,7 +245,7 @@ stdenv.mkDerivation { set -u '' - + optionalString (libc != null) '' + + optionalString (libc != null) ('' ## ## General libc support ## @@ -215,9 +263,48 @@ stdenv.mkDerivation { # another -idirafter is necessary to add that directory again. echo "-B${libc_lib}/lib/ -idirafter ${libc_dev}/include -idirafter ${cc}/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags + echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags + echo "${libc_lib}" > $out/nix-support/orig-libc echo "${libc_dev}" > $out/nix-support/orig-libc-dev - '' + + ## + ## Dynamic linker support + ## + + if [[ -z ''${dynamicLinker+x} ]]; then + echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2 + local dynamicLinker="${libc_lib}/lib/ld*.so.?" + fi + + # Expand globs to fill array of options + dynamicLinker=($dynamicLinker) + + case ''${#dynamicLinker[@]} in + 0) echo "No dynamic linker found for platform '${targetPlatform.config}'." >&2;; + 1) echo "Using dynamic linker: '$dynamicLinker'" >&2;; + *) echo "Multiple dynamic linkers found for platform '${targetPlatform.config}'." >&2;; + esac + + if [ -n "$dynamicLinker" ]; then + echo $dynamicLinker > $out/nix-support/dynamic-linker + + '' + (if targetPlatform.isDarwin then '' + printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook + '' else '' + if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then + echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 + fi + + local ldflagsBefore=(-dynamic-linker "$dynamicLinker") + '') + '' + fi + + # The dynamic linker is passed in `ldflagsBefore' to allow + # explicit overrides of the dynamic linker by callers to gcc/ld + # (the *last* value counts, so ours should come first). + printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before + '') + optionalString (!nativeTools) '' @@ -258,6 +345,7 @@ stdenv.mkDerivation { # Propagate the wrapped cc so that if you install the wrapper, # you get tools like gcov, the manpages, etc. as well (including # for binutils and Glibc). + printWords ${cc} ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages '' @@ -267,7 +355,14 @@ stdenv.mkDerivation { ## Hardening support ## + # some linkers on some platforms don't support specific -z flags export hardening_unsupported_flags="" + if [[ "$($ldPath/${prefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then + hardening_unsupported_flags+=" bindnow" + fi + if [[ "$($ldPath/${prefix}ld -z relro 2>&1 || true)" =~ un(recognized|known)\ option ]]; then + hardening_unsupported_flags+=" relro" + fi '' + optionalString hostPlatform.isCygwin '' @@ -286,7 +381,7 @@ stdenv.mkDerivation { '' + extraBuildCommands; - inherit expand-response-params; + inherit dynamicLinker expand-response-params; # for substitution in utils.sh expandResponseParams = "${expand-response-params}/bin/expand-response-params"; @@ -301,5 +396,7 @@ stdenv.mkDerivation { { description = stdenv.lib.attrByPath ["meta" "description"] "System C compiler" cc_ + " (wrapper script)"; + } // optionalAttrs useMacosReexportHack { + platforms = stdenv.lib.platforms.darwin; }; } diff --git a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh index 63e5d99d5017..f0c922a3d5b4 100644 --- a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh @@ -13,12 +13,12 @@ if [ -n "@coreutils_bin@" ]; then PATH="@coreutils_bin@/bin" fi -source @out@/nix-support/utils.sh - if [ -z "${NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET:-}" ]; then source @out@/nix-support/add-flags.sh fi +source @out@/nix-support/utils.sh + # Figure out if linker flags should be passed. GCC prints annoying # warnings when they are not needed. diff --git a/pkgs/build-support/binutils-wrapper/ld-solaris-wrapper.sh b/pkgs/build-support/cc-wrapper/ld-solaris-wrapper.sh old mode 100644 new mode 100755 similarity index 100% rename from pkgs/build-support/binutils-wrapper/ld-solaris-wrapper.sh rename to pkgs/build-support/cc-wrapper/ld-solaris-wrapper.sh diff --git a/pkgs/build-support/binutils-wrapper/ld-wrapper.sh b/pkgs/build-support/cc-wrapper/ld-wrapper.sh similarity index 92% rename from pkgs/build-support/binutils-wrapper/ld-wrapper.sh rename to pkgs/build-support/cc-wrapper/ld-wrapper.sh index dd30c4d55ef7..a9cc1e3f9e6f 100644 --- a/pkgs/build-support/binutils-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/ld-wrapper.sh @@ -10,12 +10,12 @@ if [ -n "@coreutils_bin@" ]; then PATH="@coreutils_bin@/bin" fi -source @out@/nix-support/utils.sh - -if [ -z "${NIX_BINUTILS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then source @out@/nix-support/add-flags.sh fi +source @out@/nix-support/utils.sh + # Optionally filter out paths not refering to the store. expandResponseParams "$@" @@ -63,21 +63,6 @@ fi extraAfter+=($NIX_@infixSalt@_LDFLAGS_AFTER) -# Choose 32-bit dynamic linker if needed -if [ -e @out@/nix-support/dynamic-linker-m32 ]; then - prev= - for p in ${params+"${params[@]}"}; do - if [[ "$prev" = "-m" && "$p" = "elf_i386" ]]; then - extraAfter+=( - '-dynamic-linker' - "$(< @out@/nix-support/dynamic-linker-m32)" - ) - break - fi - prev="$p" - done -fi - declare -a libDirs declare -A libs relocatable= diff --git a/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash b/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash new file mode 100644 index 000000000000..b7aa7ea5c092 --- /dev/null +++ b/pkgs/build-support/cc-wrapper/macos-sierra-reexport-hack.bash @@ -0,0 +1,106 @@ +#! @shell@ + +set -eu -o pipefail + +path_backup="$PATH" +if [ -n "@coreutils_bin@" ]; then + PATH="@coreutils_bin@/bin" +fi + +declare -r recurThreshold=300 + +declare overflowCount=0 +for ((n=0; n < $#; ++n)); do + case "${!n}" in + -l*) let overflowCount+=1 ;; + -reexport-l*) let overflowCount+=1 ;; + *) ;; + esac +done + +declare -a allArgs=() + +if (( "$overflowCount" <= "$recurThreshold" )); then + allArgs=("$@") +else + declare -a childrenLookup=() childrenLink=() + + while (( $# )); do + case "$1" in + -L/*) + childrenLookup+=("$1") + allArgs+=("$1") + ;; + -L) + echo "cctools LD does not support '-L foo' or '-l foo'" >&2 + exit 1 + ;; + -l) + echo "cctools LD does not support '-L foo' or '-l foo'" >&2 + exit 1 + ;; + -lazy_library | -lazy_framework | -lto_library) + # We aren't linking any "azy_library", "to_library", etc. + allArgs+=("$1") + ;; + -lazy-l | -weak-l) allArgs+=("$1") ;; + # We can't so easily prevent header issues from these. + -lSystem) allArgs+=("$1") ;; + # Special case as indirection seems like a bad idea for something + # so fundamental. Can be removed for simplicity. + -l?* | -reexport-l?*) childrenLink+=("$1") ;; + *) allArgs+=("$1") ;; + esac + + shift + done + + declare n=0 + while (( $n < "${#childrenLink[@]}" )); do + if [[ "${childrenLink[n]}" = -l* ]]; then + childrenLink[n]="-reexport${childrenLink[n]}" + fi + let ++n + done + unset n + + declare -r outputNameLibless=$(basename $( \ + if [[ -z "${outputName:+isUndefined}" ]]; then + echo unnamed + elif [[ "${outputName:0:3}" = lib ]]; then + echo "${outputName:3}" + else + echo "${outputName}" + fi)) + declare -ra children=("$outputNameLibless-reexport-delegate-0" \ + "$outputNameLibless-reexport-delegate-1") + + mkdir -p "$out/lib" + + PATH="$PATH:@out@/bin" + + symbolBloatObject=$outputNameLibless-symbol-hack.o + if [[ ! -e $symbolBloatObject ]]; then + printf '.private_extern _______child_hack_foo\nchild_hack_foo:\n' \ + | @binPrefix@as -- -o $symbolBloatObject + fi + + # first half of libs + @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ + -o "$out/lib/lib${children[0]}.dylib" \ + -install_name "$out/lib/lib${children[0]}.dylib" \ + "${childrenLookup[@]}" "$symbolBloatObject" \ + "${childrenLink[@]:0:$((${#childrenLink[@]} / 2 ))}" + + # second half of libs + @binPrefix@ld -macosx_version_min $MACOSX_DEPLOYMENT_TARGET -arch x86_64 -dylib \ + -o "$out/lib/lib${children[1]}.dylib" \ + -install_name "$out/lib/lib${children[1]}.dylib" \ + "${childrenLookup[@]}" "$symbolBloatObject" \ + "${childrenLink[@]:$((${#childrenLink[@]} / 2 ))}" + + allArgs+=("-L$out/lib" "-l${children[0]}" "-l${children[1]}") +fi + +PATH="$path_backup" +exec @prog@ "${allArgs[@]}" diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index 9273f50c6670..e43c1609edb1 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -74,6 +74,14 @@ ccWrapper_addCVars () { export NIX_${role}CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include" fi + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_${role}LDFLAGS+=" -L$1/lib64" + fi + + if [[ -d "$1/lib" ]]; then + export NIX_${role}LDFLAGS+=" -L$1/lib" + fi + if [[ -d "$1/Library/Frameworks" ]]; then export NIX_${role}CFLAGS_COMPILE+=" -F$1/Library/Frameworks" fi @@ -108,6 +116,11 @@ if [ -n "@cc@" ]; then addToSearchPath _PATH @cc@/bin fi +# shellcheck disable=SC2157 +if [ -n "@binutils_bin@" ]; then + addToSearchPath _PATH @binutils_bin@/bin +fi + # shellcheck disable=SC2157 if [ -n "@libc_bin@" ]; then addToSearchPath _PATH @libc_bin@/bin @@ -125,5 +138,15 @@ export NIX_${role}CC=@out@ export ${role}CC=@named_cc@ export ${role}CXX=@named_cxx@ +for CMD in \ + ar as nm objcopy ranlib strip strings size ld windres +do + if + PATH=$_PATH type -p "@binPrefix@$CMD" > /dev/null + then + export "${role}$(echo "$CMD" | tr "[:lower:]" "[:upper:]")=@binPrefix@${CMD}"; + fi +done + # No local scope in sourced file unset role diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh index a9ab2b23f24d..c84a094e26b0 100644 --- a/pkgs/build-support/cc-wrapper/utils.sh +++ b/pkgs/build-support/cc-wrapper/utils.sh @@ -1,35 +1,3 @@ -mangleVarList() { - local var="$1" - shift - local -a role_infixes=("$@") - - local outputVar="${var/+/_@infixSalt@_}" - declare -gx ${outputVar}+='' - # For each role we serve, we accumulate the input parameters into our own - # cc-wrapper-derivation-specific environment variables. - for infix in "${role_infixes[@]}"; do - local inputVar="${var/+/${infix}}" - if [ -v "$inputVar" ]; then - export ${outputVar}+="${!outputVar:+ }${!inputVar}" - fi - done -} - -mangleVarBool() { - local var="$1" - shift - local -a role_infixes=("$@") - - local outputVar="${var/+/_@infixSalt@_}" - declare -gxi ${outputVar}+='' - for infix in "${role_infixes[@]}"; do - local inputVar="${var/+/${infix}}" - if [ -v "$inputVar" ]; then - let "${outputVar} |= ${!inputVar}" - fi - done -} - skip () { if [ -n "${NIX_DEBUG:-}" ]; then echo "skipping impure path $1" >&2 diff --git a/pkgs/desktops/maxx/default.nix b/pkgs/desktops/maxx/default.nix index 5797d6566a81..891d644071c1 100644 --- a/pkgs/desktops/maxx/default.nix +++ b/pkgs/desktops/maxx/default.nix @@ -59,7 +59,7 @@ in stdenv.mkDerivation { while IFS= read -r -d ''$'\0' i; do if isELF "$i"; then - bin=`patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$i"; echo $?` + bin=`patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"; echo $?` patchelf --set-rpath "${stdenv.lib.makeLibraryPath deps}" "$i" if [ "$bin" -eq 0 ]; then wrapProgram "$i" \ diff --git a/pkgs/development/arduino/arduino-core/default.nix b/pkgs/development/arduino/arduino-core/default.nix index 79f65c181141..fdb9d1be6ad2 100644 --- a/pkgs/development/arduino/arduino-core/default.nix +++ b/pkgs/development/arduino/arduino-core/default.nix @@ -135,7 +135,7 @@ stdenv.mkDerivation rec { cp ${teensyduino_src} ./TeensyduinoInstall.${teensy_architecture} chmod +w ./TeensyduinoInstall.${teensy_architecture} upx -d ./TeensyduinoInstall.${teensy_architecture} - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "${teensy_libpath}" \ ./TeensyduinoInstall.${teensy_architecture} chmod +x ./TeensyduinoInstall.${teensy_architecture} @@ -181,7 +181,7 @@ stdenv.mkDerivation rec { preFixup = '' for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$file" || true + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true patchelf --set-rpath ${rpath}:$out/lib $file || true done @@ -203,7 +203,7 @@ stdenv.mkDerivation rec { ${stdenv.lib.optionalString withTeensyduino '' # Patch the Teensy loader binary patchelf --debug \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "${teensy_libpath}" \ $out/share/arduino/hardware/tools/teensy ''} diff --git a/pkgs/development/compilers/cmucl/binary.nix b/pkgs/development/compilers/cmucl/binary.nix index 4086e8d4dd60..2833c5378c1d 100644 --- a/pkgs/development/compilers/cmucl/binary.nix +++ b/pkgs/development/compilers/cmucl/binary.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation { buildCommand = '' mkdir -p $out tar -C $out -xjf ${dist} - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/lisp ''; diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index b17363516fd4..62a504ef9668 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { --suffix DYLD_LIBRARY_PATH : $libPath '' else '' - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ crystal-${version}-1/embedded/bin/crystal patchelf --set-rpath ${ stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] } \ crystal-${version}-1/embedded/bin/crystal diff --git a/pkgs/development/compilers/cudatoolkit/default.nix b/pkgs/development/compilers/cudatoolkit/default.nix index f65fd4711ae2..0b219b804471 100644 --- a/pkgs/development/compilers/cudatoolkit/default.nix +++ b/pkgs/development/compilers/cudatoolkit/default.nix @@ -49,7 +49,7 @@ let echo "patching $i..." if [[ ! $i =~ \.so ]]; then patchelf \ - --set-interpreter "''$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $i + --set-interpreter "''$(cat $NIX_CC/nix-support/dynamic-linker)" $i fi rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64 patchelf --set-rpath $rpath2 --force-rpath $i diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index 443f674cf1d8..ee56425f00b4 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -25,7 +25,7 @@ if test "$noSysDirs" = "1"; then # Figure out what extra flags to pass to the gcc compilers # being generated to make sure that they use our glibc. extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)" - extraLDFlags="$(cat $NIX_BINUTILS/nix-support/libc-ldflags) $(cat $NIX_BINUTILS/nix-support/libc-ldflags-before || true)" + extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before || true)" # Use *real* header files, otherwise a limits.h is generated # that does not include Glibc's limits.h (notably missing diff --git a/pkgs/development/compilers/ghc/6.10.2-binary.nix b/pkgs/development/compilers/ghc/6.10.2-binary.nix index 5d03573dbab4..60749a29b58b 100644 --- a/pkgs/development/compilers/ghc/6.10.2-binary.nix +++ b/pkgs/development/compilers/ghc/6.10.2-binary.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { # find editline/gmp. (if stdenv.isLinux then '' find . -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \; for prog in ld ar gcc strip ranlib; do find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; diff --git a/pkgs/development/compilers/ghc/7.0.4-binary.nix b/pkgs/development/compilers/ghc/7.0.4-binary.nix index 10aa63ed4e35..6140cde4a9ef 100644 --- a/pkgs/development/compilers/ghc/7.0.4-binary.nix +++ b/pkgs/development/compilers/ghc/7.0.4-binary.nix @@ -61,7 +61,7 @@ stdenv.mkDerivation rec { # find editline/gmp. stdenv.lib.optionalString stdenv.isLinux '' find . -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${stdenv.lib.makeLibraryPath [ ncurses5 gmp ]}" {} \; sed -i "s|/usr/bin/perl|perl\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2 sed -i "s|/usr/bin/gcc|gcc\x00 |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2 diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix index 43775a343c11..100bb87768b5 100644 --- a/pkgs/development/compilers/ghc/7.4.2-binary.nix +++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix @@ -63,7 +63,7 @@ stdenv.mkDerivation rec { mkdir -p "$out/lib" ln -sv "${ncurses5.out}/lib/libncurses.so" "$out/lib/libncurses${stdenv.lib.optionalString stdenv.is64bit "w"}.so.5" find . -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${stdenv.lib.makeLibraryPath [ "$out" gmp ]}" {} \; paxmark m ./ghc-${version}/ghc/stage2/build/tmp/ghc-stage2 diff --git a/pkgs/development/compilers/gnatboot/default.nix b/pkgs/development/compilers/gnatboot/default.nix index 1cb2d3904315..a209e392bc6f 100644 --- a/pkgs/development/compilers/gnatboot/default.nix +++ b/pkgs/development/compilers/gnatboot/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation { cp -R * $out set +e for a in $out/bin/* ; do - patchelf --interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath $(cat $NIX_CC/nix-support/orig-libc)/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib64:$(cat $NIX_CC/nix-support/orig-cc)/lib $a done set -e diff --git a/pkgs/development/compilers/llvm/3.4/llvm.nix b/pkgs/development/compilers/llvm/3.4/llvm.nix index 2080aa64149b..79b0c9ff898d 100644 --- a/pkgs/development/compilers/llvm/3.4/llvm.nix +++ b/pkgs/development/compilers/llvm/3.4/llvm.nix @@ -50,7 +50,7 @@ in stdenv.mkDerivation rec { "-DLLVM_BUILD_TESTS=ON" "-DLLVM_ENABLE_FFI=ON" "-DLLVM_REQUIRES_RTTI=1" - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev or binutils.binutils}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev or binutils}/include" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "-DBUILD_SHARED_LIBS=ON"; diff --git a/pkgs/development/compilers/llvm/3.5/llvm.nix b/pkgs/development/compilers/llvm/3.5/llvm.nix index b88cd232415e..c5503da9b838 100644 --- a/pkgs/development/compilers/llvm/3.5/llvm.nix +++ b/pkgs/development/compilers/llvm/3.5/llvm.nix @@ -47,7 +47,7 @@ in stdenv.mkDerivation rec { ] ++ stdenv.lib.optional enableSharedLibraries "-DBUILD_SHARED_LIBS=ON" ++ stdenv.lib.optional (!isDarwin) - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" ++ stdenv.lib.optionals ( isDarwin) [ "-DCMAKE_CXX_FLAGS=-stdlib=libc++" "-DCAN_TARGET_i386=false" diff --git a/pkgs/development/compilers/llvm/3.7/llvm.nix b/pkgs/development/compilers/llvm/3.7/llvm.nix index ce35a71272bb..81aaa7cd65c2 100644 --- a/pkgs/development/compilers/llvm/3.7/llvm.nix +++ b/pkgs/development/compilers/llvm/3.7/llvm.nix @@ -67,7 +67,7 @@ in stdenv.mkDerivation rec { ] ++ stdenv.lib.optional enableSharedLibraries "-DBUILD_SHARED_LIBS=ON" ++ stdenv.lib.optional (!isDarwin) - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" ++ stdenv.lib.optionals ( isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index ce366cb4973f..a3f652d783be 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -62,7 +62,7 @@ in stdenv.mkDerivation rec { ] ++ stdenv.lib.optional enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" ] ++ stdenv.lib.optional (!isDarwin) - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" ++ stdenv.lib.optionals ( isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 98d5a0edffe6..654e1ce0023b 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -106,7 +106,7 @@ in stdenv.mkDerivation rec { ] ++ stdenv.lib.optional enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" ] ++ stdenv.lib.optional (!isDarwin) - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" ++ stdenv.lib.optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index c116164f5031..4978570334ea 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -90,7 +90,7 @@ in stdenv.mkDerivation rec { "-DSPHINX_WARNINGS_AS_ERRORS=OFF" ] ++ stdenv.lib.optional (!isDarwin) - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" ++ stdenv.lib.optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" diff --git a/pkgs/development/compilers/mentor/default.nix b/pkgs/development/compilers/mentor/default.nix index 2922cef7e7a1..74905c6ffae4 100644 --- a/pkgs/development/compilers/mentor/default.nix +++ b/pkgs/development/compilers/mentor/default.nix @@ -18,7 +18,7 @@ let tar --strip-components=1 -xjf "$src" -C "$out" # Patch binaries - interpreter="$(cat "$NIX_BINUTILS/nix-support/dynamic-linker")" + interpreter="$(cat "$NIX_CC"/nix-support/dynamic-linker)" for file in "$out"/bin/* "$out"/libexec/gcc/*/*/* "$out"/*/bin/*; do # Skip non-executable files case "$file" in diff --git a/pkgs/development/compilers/mono/llvm.nix b/pkgs/development/compilers/mono/llvm.nix index 70eac4e83b3e..1036e43ea941 100644 --- a/pkgs/development/compilers/mono/llvm.nix +++ b/pkgs/development/compilers/mono/llvm.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { cmakeFlags = with stdenv; [ "-DLLVM_ENABLE_FFI=ON" - "-DLLVM_BINUTILS_INCDIR=${binutils.binutils.dev}/include" + "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON"; diff --git a/pkgs/development/compilers/mozart/binary.nix b/pkgs/development/compilers/mozart/binary.nix index 4857af087570..ebe562fcde32 100644 --- a/pkgs/development/compilers/mozart/binary.nix +++ b/pkgs/development/compilers/mozart/binary.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation { tar xvf $src -C $out --strip-components=1 for exe in $out/bin/{ozemulator,ozwish} ; do - patchelf --set-interpreter $(< $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(< $NIX_CC/nix-support/dynamic-linker) \ --set-rpath $libPath \ $exe done diff --git a/pkgs/development/compilers/opendylan/bin.nix b/pkgs/development/compilers/opendylan/bin.nix index 009f36f57f5d..8382be7a2091 100644 --- a/pkgs/development/compilers/opendylan/bin.nix +++ b/pkgs/development/compilers/opendylan/bin.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation { mkdir -p "$out" tar --strip-components=1 -xjf "$src" -C "$out" - interpreter="$(cat "$NIX_BINUTILS/nix-support/dynamic-linker")" + interpreter="$(cat "$NIX_CC"/nix-support/dynamic-linker)" for a in "$out"/bin/*; do patchelf --set-interpreter "$interpreter" "$a" patchelf --set-rpath "$out/lib:${boehmgc.out}/lib" "$a" diff --git a/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh b/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh index 2cee0adc7d03..459bfce50988 100644 --- a/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh +++ b/pkgs/development/compilers/oraclejdk/dlj-bundle-builder.sh @@ -5,7 +5,7 @@ unzip ${src} || true # set the dynamic linker of unpack200, necessary for construct script echo "patching unpack200" -patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath "" */bin/unpack200 +patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "" */bin/unpack200 echo "constructing JDK and JRE installations" if test -z "$installjdk"; then @@ -46,7 +46,7 @@ rpath=$rpath${rpath:+:}$jrePath/lib/$architecture/jli # set all the dynamic linkers find $out -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$rpath" {} \; find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; diff --git a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix index ca954f53ab1a..2a00cf5f2d29 100644 --- a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix +++ b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix @@ -179,7 +179,7 @@ let result = stdenv.mkDerivation rec { # set all the dynamic linkers find $out -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$rpath" {} \; find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; diff --git a/pkgs/development/compilers/rust/binaryBuild.nix b/pkgs/development/compilers/rust/binaryBuild.nix index cd20fb4afdee..37b06555bdbd 100644 --- a/pkgs/development/compilers/rust/binaryBuild.nix +++ b/pkgs/development/compilers/rust/binaryBuild.nix @@ -42,17 +42,17 @@ rec { ${optionalString (needsPatchelf && bootstrapping) '' patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/rustdoc" patchelf \ --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/cargo" ''} ${optionalString needsPatchelf '' patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/rustc" # Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc @@ -88,7 +88,7 @@ rec { ${optionalString needsPatchelf '' patchelf \ --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/cargo" ''} diff --git a/pkgs/development/compilers/sbcl/bootstrap.nix b/pkgs/development/compilers/sbcl/bootstrap.nix index 1cddcd6bc5bd..707f7966dd9b 100644 --- a/pkgs/development/compilers/sbcl/bootstrap.nix +++ b/pkgs/development/compilers/sbcl/bootstrap.nix @@ -66,7 +66,7 @@ stdenv.mkDerivation rec { ''; postFixup = stdenv.lib.optionalString (!stdenv.isArm && stdenv.isLinux) '' - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $out/share/sbcl/sbcl + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/share/sbcl/sbcl ''; meta = with stdenv.lib; { diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix index 89e77769f5a8..094007aa2d0f 100644 --- a/pkgs/development/compilers/tinycc/default.nix +++ b/pkgs/development/compilers/tinycc/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { echo ${version} > VERSION configureFlagsArray+=("--cc=cc") - configureFlagsArray+=("--elfinterp=$(< $NIX_BINUTILS/nix-support/dynamic-linker)") + configureFlagsArray+=("--elfinterp=$(< $NIX_CC/nix-support/dynamic-linker)") configureFlagsArray+=("--crtprefix=${getLib stdenv.cc.libc}/lib") configureFlagsArray+=("--sysincludepaths=${getDev stdenv.cc.libc}/include:{B}/include") configureFlagsArray+=("--libpaths=${getLib stdenv.cc.libc}/lib") diff --git a/pkgs/development/compilers/zulu/default.nix b/pkgs/development/compilers/zulu/default.nix index 72ee89dc3504..f7638757ff7a 100644 --- a/pkgs/development/compilers/zulu/default.nix +++ b/pkgs/development/compilers/zulu/default.nix @@ -48,7 +48,7 @@ in stdenv.mkDerivation rec { # set all the dynamic linkers find $out -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$rpath" {} \; find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; diff --git a/pkgs/development/interpreters/dart/default.nix b/pkgs/development/interpreters/dart/default.nix index bb800bb62a93..3d19f7ba2911 100644 --- a/pkgs/development/interpreters/dart/default.nix +++ b/pkgs/development/interpreters/dart/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation { mkdir -p $out cp -R * $out/ echo $libPath - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath \ $out/bin/dart ''; diff --git a/pkgs/development/interpreters/rebol/default.nix b/pkgs/development/interpreters/rebol/default.nix index 5af1fd62256a..8a13c4efce61 100644 --- a/pkgs/development/interpreters/rebol/default.nix +++ b/pkgs/development/interpreters/rebol/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { configurePhase = '' cp ${r3} make/r3-make chmod 777 make/r3-make - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" ./make/r3-make + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./make/r3-make cd make perl -pi -e 's#-m32##g' makefile perl -pi -e 's#sudo .*#echo#g' makefile diff --git a/pkgs/development/libraries/libstdc++5/default.nix b/pkgs/development/libraries/libstdc++5/default.nix index 4f4040ce5ed7..abe0538b8a9c 100644 --- a/pkgs/development/libraries/libstdc++5/default.nix +++ b/pkgs/development/libraries/libstdc++5/default.nix @@ -62,10 +62,7 @@ stdenv.mkDerivation rec { # being generated to make sure that they use our glibc. EXTRA_FLAGS="-I$NIX_FIXINC_DUMMY $(cat $NIX_CC/nix-support/libc-cflags) -O2" - extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir" - extraLDFlags+=" $(cat $NIX_BINUTILS/nix-support/libc-ldflags)" - extraLDFlags+=" $(cat $NIX_BINUTILS/nix-support/libc-ldflags-before)" - + extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)" for i in $extraLDFlags; do EXTRA_FLAGS="$EXTRA_FLAGS -Wl,$i" done diff --git a/pkgs/development/libraries/oracle-instantclient/default.nix b/pkgs/development/libraries/oracle-instantclient/default.nix index 9119e4beb4f5..d0085752623d 100644 --- a/pkgs/development/libraries/oracle-instantclient/default.nix +++ b/pkgs/development/libraries/oracle-instantclient/default.nix @@ -67,7 +67,7 @@ in stdenv.mkDerivation rec { done for exe in $out/bin/sqlplus; do - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --force-rpath --set-rpath "$out/lib:${libaio}/lib" \ $exe done diff --git a/pkgs/development/libraries/wtk/builder.sh b/pkgs/development/libraries/wtk/builder.sh index ed9c052cf09d..86f2719537cd 100644 --- a/pkgs/development/libraries/wtk/builder.sh +++ b/pkgs/development/libraries/wtk/builder.sh @@ -22,6 +22,6 @@ for i in $libraries; do rpath=$rpath${rpath:+:}$i/lib done find $out -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" {} \; + -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \; find $out -type f -perm -0100 \ -exec patchelf --set-rpath "$rpath" {} \; diff --git a/pkgs/development/misc/amdapp-sdk/default.nix b/pkgs/development/misc/amdapp-sdk/default.nix index 5486230541f1..fc2981f7f1f7 100644 --- a/pkgs/development/misc/amdapp-sdk/default.nix +++ b/pkgs/development/misc/amdapp-sdk/default.nix @@ -87,7 +87,7 @@ in stdenv.mkDerivation rec { } # Create wrappers - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/bin/clinfo + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/clinfo patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64:${stdenv.cc.cc.lib}/lib $out/bin/clinfo # Fix modes diff --git a/pkgs/development/mobile/flashtool/default.nix b/pkgs/development/mobile/flashtool/default.nix index f9cd6bc3c403..0c1bb5d4d42d 100644 --- a/pkgs/development/mobile/flashtool/default.nix +++ b/pkgs/development/mobile/flashtool/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { ln -s ${libusb1.out}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so chmod +x x10flasher_lib/unyaffs.linux.x86 x10flasher_lib/bin2elf x10flasher_lib/bin2sin - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" x10flasher_lib/unyaffs.linux.x86 + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" x10flasher_lib/unyaffs.linux.x86 ln -sf unyaffs.linux.x86 x10flasher_lib/unyaffs.linux ln -s swt32.jar x10flasher_lib/swtlin/swt.jar diff --git a/pkgs/development/mobile/genymotion/default.nix b/pkgs/development/mobile/genymotion/default.nix index c957f4151a07..745111171bb6 100644 --- a/pkgs/development/mobile/genymotion/default.nix +++ b/pkgs/development/mobile/genymotion/default.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { fixupPhase = '' patchInterpreter() { - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ "$out/libexec/genymotion/$1" } diff --git a/pkgs/development/tools/electron/default.nix b/pkgs/development/tools/electron/default.nix index 7a4e326ee8a0..74884e6f5a8a 100644 --- a/pkgs/development/tools/electron/default.nix +++ b/pkgs/development/tools/electron/default.nix @@ -31,7 +31,7 @@ let fixupPhase patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${atomEnv.libPath}:$out/lib/electron" \ $out/lib/electron/electron diff --git a/pkgs/development/tools/misc/saleae-logic/default.nix b/pkgs/development/tools/misc/saleae-logic/default.nix index 5a20a2ac1674..86be86cb6d63 100644 --- a/pkgs/development/tools/misc/saleae-logic/default.nix +++ b/pkgs/development/tools/misc/saleae-logic/default.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { cp -r * "$out" # Patch it - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$out/Logic" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/Logic" patchelf --set-rpath "${stdenv.cc.cc.lib}/lib:${stdenv.cc.cc.lib}/lib64:${libPath}:\$ORIGIN/Analyzers:\$ORIGIN" "$out/Logic" # Build the LD_PRELOAD library that makes Logic work from a read-only directory diff --git a/pkgs/development/tools/node-webkit/nw11.nix b/pkgs/development/tools/node-webkit/nw11.nix index 373032686ae1..5028ac9580c5 100644 --- a/pkgs/development/tools/node-webkit/nw11.nix +++ b/pkgs/development/tools/node-webkit/nw11.nix @@ -34,8 +34,8 @@ in stdenv.mkDerivation rec { mkdir -p $out/share/node-webkit cp -R * $out/share/node-webkit - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/node-webkit/nw - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/node-webkit/nwsnapshot + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/node-webkit/nw + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/node-webkit/nwsnapshot ln -s ${systemd.lib}/lib/libudev.so $out/share/node-webkit/libudev.so.0 diff --git a/pkgs/development/tools/node-webkit/nw12.nix b/pkgs/development/tools/node-webkit/nw12.nix index 5205d534ab82..8e2953839b71 100644 --- a/pkgs/development/tools/node-webkit/nw12.nix +++ b/pkgs/development/tools/node-webkit/nw12.nix @@ -36,8 +36,8 @@ in stdenv.mkDerivation rec { mkdir -p $out/share/nwjs cp -R * $out/share/nwjs - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/nwjs/nw - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/nwjs/nwjc + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/nwjs/nw + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/nwjs/nwjc ln -s ${systemd.lib}/lib/libudev.so $out/share/nwjs/libudev.so.0 diff --git a/pkgs/development/tools/node-webkit/nw9.nix b/pkgs/development/tools/node-webkit/nw9.nix index 803f55f81347..ba5d6c8e3343 100644 --- a/pkgs/development/tools/node-webkit/nw9.nix +++ b/pkgs/development/tools/node-webkit/nw9.nix @@ -32,8 +32,8 @@ in stdenv.mkDerivation rec { mkdir -p $out/share/node-webkit cp -R * $out/share/node-webkit - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/node-webkit/nw - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/share/node-webkit/nwsnapshot + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/node-webkit/nw + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/node-webkit/nwsnapshot ln -s ${systemd.lib}/lib/libudev.so $out/share/node-webkit/libudev.so.0 diff --git a/pkgs/development/tools/phantomjs/default.nix b/pkgs/development/tools/phantomjs/default.nix index 9daa93ca3bb1..8b6b655b6a56 100644 --- a/pkgs/development/tools/phantomjs/default.nix +++ b/pkgs/development/tools/phantomjs/default.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { buildPhase = lib.optionalString (!stdenv.isDarwin) '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${stdenv.lib.makeLibraryPath [ freetype fontconfig stdenv.cc.cc stdenv.cc.cc openssl ]}" \ bin/phantomjs ''; diff --git a/pkgs/development/tools/sauce-connect/default.nix b/pkgs/development/tools/sauce-connect/default.nix index 4f06c3ad63db..3caec9a75c15 100644 --- a/pkgs/development/tools/sauce-connect/default.nix +++ b/pkgs/development/tools/sauce-connect/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { patchPhase = stdenv.lib.optionalString stdenv.isLinux '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/lib:${makeLibraryPath [zlib]}" \ bin/sc ''; diff --git a/pkgs/development/tools/thrust/default.nix b/pkgs/development/tools/thrust/default.nix index a59c8153cafc..91a01edc23a6 100644 --- a/pkgs/development/tools/thrust/default.nix +++ b/pkgs/development/tools/thrust/default.nix @@ -30,7 +30,7 @@ in stdenv.mkDerivation rec { mkdir -p $out/bin mkdir -p $out/libexec/thrust unzip -d $out/libexec/thrust/ $src - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/libexec/thrust/thrust_shell wrapProgram $out/libexec/thrust/thrust_shell \ --prefix "LD_LIBRARY_PATH" : "${thrustEnv}/lib:${thrustEnv}/lib64" diff --git a/pkgs/development/tools/unity3d/default.nix b/pkgs/development/tools/unity3d/default.nix index e3d0f7f5845e..c7ba985d0f75 100644 --- a/pkgs/development/tools/unity3d/default.nix +++ b/pkgs/development/tools/unity3d/default.nix @@ -99,10 +99,10 @@ in stdenv.mkDerivation rec { if [[ "$ftype" =~ LSB\ .*dynamically\ linked ]]; then if [[ "$ftype" =~ 32-bit ]]; then rpath="${libPath32}" - intp="$(cat $NIX_BINUTILS/nix-support/dynamic-linker-m32)" + intp="$(cat $NIX_CC/nix-support/dynamic-linker-m32)" else rpath="${libPath64}" - intp="$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" + intp="$(cat $NIX_CC/nix-support/dynamic-linker)" fi oldRpath="$(patchelf --print-rpath "$1")" diff --git a/pkgs/games/adom/default.nix b/pkgs/games/adom/default.nix index 77157e962e1a..016c965b6c0b 100644 --- a/pkgs/games/adom/default.nix +++ b/pkgs/games/adom/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { done ${patchelf}/bin/patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/lib:${lpath}" \ $out/adom diff --git a/pkgs/games/andyetitmoves/default.nix b/pkgs/games/andyetitmoves/default.nix index c9fa3a1d05e6..092f07737084 100644 --- a/pkgs/games/andyetitmoves/default.nix +++ b/pkgs/games/andyetitmoves/default.nix @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { binName=${if commercialVersion then "AndYetItMoves" else "AndYetItMovesDemo"} - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) --set-rpath $fullPath $out/opt/andyetitmoves/lib/$binName + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath $fullPath $out/opt/andyetitmoves/lib/$binName cat > $out/bin/$binName << EOF #!/bin/sh cd $out/opt/andyetitmoves diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix index e8db1de76283..e10d97a047b4 100644 --- a/pkgs/games/factorio/default.nix +++ b/pkgs/games/factorio/default.nix @@ -82,7 +82,7 @@ let cp -a data $out/share/factorio cp -a bin/${arch.inTar}/factorio $out/bin/factorio patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ $out/bin/factorio ''; diff --git a/pkgs/games/oilrush/default.nix b/pkgs/games/oilrush/default.nix index b6c4e5f71f97..d637c1595954 100644 --- a/pkgs/games/oilrush/default.nix +++ b/pkgs/games/oilrush/default.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation { cd bin for f in launcher_$arch libQtCoreUnigine_$arch.so.4 OilRush_$arch do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $f + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f done patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64:${makeLibraryPath [ stdenv.cc.cc libX11 libXext libXrender fontconfig freetype ]}\ launcher_$arch diff --git a/pkgs/games/openarena/default.nix b/pkgs/games/openarena/default.nix index 41feab11f2a3..1e396318bbbd 100644 --- a/pkgs/games/openarena/default.nix +++ b/pkgs/games/openarena/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { installPhase = let gameDir = "$out/openarena-$version"; - interpreter = "$(< \"$NIX_BINUTILS/nix-support/dynamic-linker\")"; + interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")"; libPath = stdenv.lib.makeLibraryPath [ SDL libogg libvorbis ]; in '' mkdir -pv $out/bin diff --git a/pkgs/games/planetaryannihilation/default.nix b/pkgs/games/planetaryannihilation/default.nix index 1f3223a30543..451d4b71296a 100644 --- a/pkgs/games/planetaryannihilation/default.nix +++ b/pkgs/games/planetaryannihilation/default.nix @@ -33,8 +33,8 @@ stdenv.mkDerivation { ln -s ${systemd}/lib/libudev.so.1 $out/lib/libudev.so.0 - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$out/PA" - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib xorg.libXdamage xorg.libXfixes gtk2 glib stdenv.glibc.out "$out" xorg.libXext pango udev xorg.libX11 xorg.libXcomposite alsaLib atk nspr fontconfig cairo pango nss freetype gnome3.gconf gdk_pixbuf xorg.libXrender ]}:{stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" "$out/host/CoherentUI_Host" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/PA" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib xorg.libXdamage xorg.libXfixes gtk2 glib stdenv.glibc.out "$out" xorg.libXext pango udev xorg.libX11 xorg.libXcomposite alsaLib atk nspr fontconfig cairo pango nss freetype gnome3.gconf gdk_pixbuf xorg.libXrender ]}:{stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" "$out/host/CoherentUI_Host" wrapProgram $out/PA --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc.lib stdenv.glibc.out xorg.libX11 xorg.libXcursor gtk2 glib curl "$out" ]}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" diff --git a/pkgs/games/scrolls/default.nix b/pkgs/games/scrolls/default.nix index dd84c38b486b..c2beeb13cadf 100644 --- a/pkgs/games/scrolls/default.nix +++ b/pkgs/games/scrolls/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation { cp -r ../Scrolls_Data "$out/opt/Scrolls/" chmod +x "$out/opt/Scrolls/Scrolls" - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$libPath" "$out/opt/Scrolls/Scrolls" mkdir "$out/bin" diff --git a/pkgs/games/sdlmame/default.nix b/pkgs/games/sdlmame/default.nix index 5064c8d9d343..947e52e1f13d 100644 --- a/pkgs/games/sdlmame/default.nix +++ b/pkgs/games/sdlmame/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { installPhase = '' patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${stdenv.lib.makeLibraryPath [ alsaLib qt48 SDL fontconfig freetype SDL_ttf xorg.libX11 xorg.libXinerama stdenv.cc.cc ]}" \ share/sdlmame/sdlmame diff --git a/pkgs/games/terraria-server/default.nix b/pkgs/games/terraria-server/default.nix index 15a5c2ec9070..5fcb5063bbc8 100644 --- a/pkgs/games/terraria-server/default.nix +++ b/pkgs/games/terraria-server/default.nix @@ -21,8 +21,8 @@ stdenv.mkDerivation rec { # Fix "/lib64/ld-linux-x86-64.so.2" like references in ELF executables. find "$out" | while read filepath; do if file "$filepath" | grep -q "ELF.*executable"; then - echo "setting interpreter $(cat "$NIX_BINUTILS/nix-support/dynamic-linker") in $filepath" - patchelf --set-interpreter "$(cat "$NIX_BINUTILS/nix-support/dynamic-linker")" "$filepath" + echo "setting interpreter $(cat "$NIX_CC"/nix-support/dynamic-linker) in $filepath" + patchelf --set-interpreter "$(cat "$NIX_CC"/nix-support/dynamic-linker)" "$filepath" test $? -eq 0 || { echo "patchelf failed to process $filepath"; exit 1; } fi done diff --git a/pkgs/games/vessel/default.nix b/pkgs/games/vessel/default.nix index 64f19ff7ab86..34b9a606fb96 100644 --- a/pkgs/games/vessel/default.nix +++ b/pkgs/games/vessel/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { echo @@@ # if we call ld.so $(bin) we don't need to set the ELF interpreter, and save a patchelf step. - LD_PRELOAD=./isatty.so $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $src << IM_A_BOT + LD_PRELOAD=./isatty.so $(cat $NIX_CC/nix-support/dynamic-linker) $src << IM_A_BOT n $out/libexec/strangeloop/vessel/ IM_A_BOT @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { # props to Ethan Lee (the Vessel porter) for understanding # how $ORIGIN works in rpath. There is hope for humanity. patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath:$out/libexec/strangeloop/vessel/x86/ \ $out/libexec/strangeloop/vessel/x86/vessel.x86 diff --git a/pkgs/games/worldofgoo/default.nix b/pkgs/games/worldofgoo/default.nix index d69a50f56e7d..ba887d91de19 100644 --- a/pkgs/games/worldofgoo/default.nix +++ b/pkgs/games/worldofgoo/default.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { mkdir -p $out/libexec/2dboy/WorldOfGoo/ mkdir -p $out/bin - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath $libPath ./WorldOfGoo.bin64 + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath $libPath ./WorldOfGoo.bin64 cp -r * $out/libexec/2dboy/WorldOfGoo/ diff --git a/pkgs/misc/cups/drivers/kyocera/default.nix b/pkgs/misc/cups/drivers/kyocera/default.nix index b75b903d06e4..be9d4f837092 100644 --- a/pkgs/misc/cups/drivers/kyocera/default.nix +++ b/pkgs/misc/cups/drivers/kyocera/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { install -Dm755 English/rastertokpsl $out/lib/cups/filter/rastertokpsl patchelf \ --set-rpath ${libPath} \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ $out/lib/cups/filter/rastertokpsl mkdir -p $out/share/cups/model/Kyocera diff --git a/pkgs/misc/cups/drivers/mfcl2700dnlpr/default.nix b/pkgs/misc/cups/drivers/mfcl2700dnlpr/default.nix index fba2bb88acb7..b0a030469349 100644 --- a/pkgs/misc/cups/drivers/mfcl2700dnlpr/default.nix +++ b/pkgs/misc/cups/drivers/mfcl2700dnlpr/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { coreutils ghostscript gnugrep gnused which ]} - interpreter=$(cat $NIX_BINUTILS/nix-support/dynamic-linker) + interpreter=$(cat $NIX_CC/nix-support/dynamic-linker) patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3 patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3 diff --git a/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh b/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh index 0d68fc5b09c1..f750df6e5063 100644 --- a/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh +++ b/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh @@ -27,7 +27,7 @@ ln -s ppd model cd $out/lib/cups/filter for i in $(ls); do echo "Patching $i..." - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $i || + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i || echo "Couldn't set interpreter!" patchelf --set-rpath $cups/lib:$gcc/lib:$glibc/lib $i # This might not be necessary. done diff --git a/pkgs/misc/cups/drivers/samsung/4.01.17.nix b/pkgs/misc/cups/drivers/samsung/4.01.17.nix index 22a0986e1fbb..b30b4c4a2c18 100644 --- a/pkgs/misc/cups/drivers/samsung/4.01.17.nix +++ b/pkgs/misc/cups/drivers/samsung/4.01.17.nix @@ -43,7 +43,7 @@ in stdenv.mkDerivation rec { echo "Patching $exe" patchelf \ --set-rpath ${libPath} \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ $exe done unset GLOBIGNORE diff --git a/pkgs/misc/cups/drivers/samsung/default.nix b/pkgs/misc/cups/drivers/samsung/default.nix index e837807c89e6..556c408012d2 100644 --- a/pkgs/misc/cups/drivers/samsung/default.nix +++ b/pkgs/misc/cups/drivers/samsung/default.nix @@ -69,7 +69,7 @@ in stdenv.mkDerivation rec { preFixup = '' for bin in "$out/bin/"*; do - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$bin" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$bin" patchelf --set-rpath "$out/lib:${stdenv.lib.getLib cups}/lib" "$bin" done diff --git a/pkgs/misc/drivers/gutenprint/bin.nix b/pkgs/misc/drivers/gutenprint/bin.nix index 768b9902c4b6..ac3e96e26589 100644 --- a/pkgs/misc/drivers/gutenprint/bin.nix +++ b/pkgs/misc/drivers/gutenprint/bin.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation { $out/cups/lib/backend/{canon,epson} \ $out/sbin/cups-genppd.5.0 \ ; do - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath $p done diff --git a/pkgs/misc/drivers/sundtek/default.nix b/pkgs/misc/drivers/sundtek/default.nix index 1d7021137c0b..4dc0f2591d82 100644 --- a/pkgs/misc/drivers/sundtek/default.nix +++ b/pkgs/misc/drivers/sundtek/default.nix @@ -34,7 +34,7 @@ in postFixup = '' find $out -type f -exec \ - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" {} \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \ patchelf --set-rpath ${rpath} {} \; ''; diff --git a/pkgs/misc/foldingathome/default.nix b/pkgs/misc/foldingathome/default.nix index 1b8bdc891b00..aaa932c0a1c4 100644 --- a/pkgs/misc/foldingathome/default.nix +++ b/pkgs/misc/foldingathome/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation { installPhase = '' BINFILES="fah6 mpiexec"; for a in $BINFILES; do - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $a + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $a done mkdir -p $out/bin cp $BINFILES $out/bin diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index 690fd93fcf8a..933e7558dbbf 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -2,15 +2,12 @@ , hostPlatform, targetPlatform }: -# despite the name, binutils-raw is in fact wrapped. -let binutils-unwrapped = binutils-raw.binutils; in - # Make sure both underlying packages claim to have prepended their binaries # with the same prefix. -assert binutils-unwrapped.prefix == cctools.prefix; +assert binutils-raw.prefix == cctools.prefix; let - inherit (binutils-unwrapped) prefix; + inherit (binutils-raw) prefix; cmds = [ "ar" "ranlib" "as" "dsymutil" "install_name_tool" "ld" "strip" "otool" "lipo" "nm" "strings" "size" @@ -23,7 +20,7 @@ stdenv.mkDerivation { buildCommand = '' mkdir -p $out/bin $out/include - ln -s ${binutils-unwrapped.out}/bin/${prefix}c++filt $out/bin/${prefix}c++filt + ln -s ${binutils-raw.out}/bin/${prefix}c++filt $out/bin/${prefix}c++filt # We specifically need: # - ld: binutils doesn't provide it on darwin @@ -40,7 +37,7 @@ stdenv.mkDerivation { ln -sf "${cctools}/bin/$i" "$out/bin/$i" done - for i in ${binutils-unwrapped.dev or binutils-unwrapped.out}/include/*.h; do + for i in ${binutils-raw.dev or binutils-raw.out}/include/*.h; do ln -s "$i" "$out/include/$(basename $i)" done @@ -49,8 +46,8 @@ stdenv.mkDerivation { done # FIXME: this will give us incorrect man pages for bits of cctools - ln -s ${binutils-unwrapped.out}/share $out/share - ln -s ${binutils-unwrapped.out}/lib $out/lib + ln -s ${binutils-raw.out}/share $out/share + ln -s ${binutils-raw.out}/lib $out/lib ln -s ${cctools}/libexec $out/libexec ''; diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix index 3d7bb74ce213..e7825a0ebd69 100644 --- a/pkgs/os-specific/linux/amdgpu-pro/default.nix +++ b/pkgs/os-specific/linux/amdgpu-pro/default.nix @@ -131,7 +131,7 @@ in stdenv.mkDerivation rec { "install -Dm444 usr/src/amdgpu-pro-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules) + '' mv $out/etc/vulkan $out/share - interpreter="$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" + interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)" libPath="$out/lib:$out/lib/gbm:$depLibPath" '' + optionalString (!stdenv.is64bit) '' for prog in clinfo modetest vbltest kms-universal-planes kms-steal-crtc modeprint amdgpu_test kmstest proptest; do diff --git a/pkgs/os-specific/linux/dmtcp/default.nix b/pkgs/os-specific/linux/dmtcp/default.nix index 1fdff871b73f..e67e54f7b439 100644 --- a/pkgs/os-specific/linux/dmtcp/default.nix +++ b/pkgs/os-specific/linux/dmtcp/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { postPatch = '' substituteInPlace configure \ --replace '#define ELF_INTERPRETER "$interp"' \ - "#define ELF_INTERPRETER \"$(cat $NIX_BINUTILS/nix-support/dynamic-linker)\"" + "#define ELF_INTERPRETER \"$(cat $NIX_CC/nix-support/dynamic-linker)\"" ''; preConfigure = '' diff --git a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix index a029b582f38b..bb714f60c2df 100644 --- a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix +++ b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { for f in $out/bin/*; do if isELF "$f"; then - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$f" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" patchelf --set-rpath "$out/lib" "$f" fi done diff --git a/pkgs/os-specific/linux/nvidia-x11/builder-legacy173.sh b/pkgs/os-specific/linux/nvidia-x11/builder-legacy173.sh index a4704fd51dfa..5d47df9a87a7 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder-legacy173.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder-legacy173.sh @@ -81,7 +81,7 @@ installPhase() { for i in nvidia-settings nvidia-xconfig; do cp usr/bin/$i $out/bin/$i - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $out/lib:$programPath:$glPath $out/bin/$i done diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index f41229ace86c..99813d38236b 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -111,7 +111,7 @@ installPhase() { for i in nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-smi nvidia-debugdump; do if [ -e "$i" ]; then install -Dm755 $i $bin/bin/$i - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $out/lib:$libPath $bin/bin/$i fi done diff --git a/pkgs/os-specific/linux/prl-tools/default.nix b/pkgs/os-specific/linux/prl-tools/default.nix index bc574bc0d799..9ca48ccaf057 100644 --- a/pkgs/os-specific/linux/prl-tools/default.nix +++ b/pkgs/os-specific/linux/prl-tools/default.nix @@ -122,7 +122,7 @@ stdenv.mkDerivation rec { for i in $out/bin/* $out/sbin/*; do patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "$out/lib:$libPath" \ $i done diff --git a/pkgs/servers/mattermost/default.nix b/pkgs/servers/mattermost/default.nix index 787c685e61e1..4668ac240961 100644 --- a/pkgs/servers/mattermost/default.nix +++ b/pkgs/servers/mattermost/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { ''; postFixup = '' - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/bin/platform + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/platform ''; meta = with stdenv.lib; { diff --git a/pkgs/servers/meteor/default.nix b/pkgs/servers/meteor/default.nix index 36384da20478..0b82f1deef62 100644 --- a/pkgs/servers/meteor/default.nix +++ b/pkgs/servers/meteor/default.nix @@ -39,21 +39,21 @@ stdenv.mkDerivation rec { patch -p1 < ${./main.patch} popd substituteInPlace $out/tools/cli/main.js \ - --replace "@INTERPRETER@" "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --replace "@INTERPRETER@" "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --replace "@RPATH@" "${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ --replace "@PATCHELF@" "${patchelf}/bin/patchelf" # Patch node. node=$devBundle/bin/node patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$(patchelf --print-rpath $node):${stdenv.cc.cc.lib}/lib" \ $node # Patch mongo. for p in $devBundle/mongodb/bin/mongo{,d}; do patchelf \ - --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath "$(patchelf --print-rpath $p):${lib.makeLibraryPath [ stdenv.cc.cc zlib ]}" \ $p done diff --git a/pkgs/servers/monitoring/newrelic-sysmond/default.nix b/pkgs/servers/monitoring/newrelic-sysmond/default.nix index 8ba554d1b771..e9a9fcff2b93 100644 --- a/pkgs/servers/monitoring/newrelic-sysmond/default.nix +++ b/pkgs/servers/monitoring/newrelic-sysmond/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p $out/bin install -v -m755 daemon/nrsysmond.x64 $out/bin/nrsysmond - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/nrsysmond ''; diff --git a/pkgs/servers/sql/oracle-xe/default.nix b/pkgs/servers/sql/oracle-xe/default.nix index f499743d7621..e86406cd469c 100644 --- a/pkgs/servers/sql/oracle-xe/default.nix +++ b/pkgs/servers/sql/oracle-xe/default.nix @@ -54,7 +54,7 @@ stdenv.mkDerivation rec { \( -name '*.sh' \ -o -path "$basedir/bin/*" \ \) -print -exec "${patchelf}/bin/patchelf" \ - --interpreter "$(cat "$NIX_BINUTILS/nix-support/dynamic-linker")" \ + --interpreter "$(cat "$NIX_CC/nix-support/dynamic-linker")" \ --set-rpath "${libs}:$out/libexec/oracle/lib" \ --force-rpath '{}' \; ''; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index d71cda7f8a96..f4801d674e8a 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -63,40 +63,10 @@ in rec { extraBuildInputs, allowedRequisites ? null}: let - buildPackages = lib.optionalAttrs (last ? stdenv) { - inherit (last) stdenv; - }; - - coreutils = { name = "coreutils-9.9.9"; outPath = bootstrapTools; }; - gnugrep = { name = "gnugrep-9.9.9"; outPath = bootstrapTools; }; - - binutils = import ../../build-support/binutils-wrapper { - inherit shell; - inherit (last) stdenv; - - nativeTools = false; - nativeLibc = false; - inherit buildPackages coreutils gnugrep; - libc = last.pkgs.darwin.Libsystem; - binutils = { name = "binutils-9.9.9"; outPath = bootstrapTools; }; - }; - - cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper { - inherit shell; - inherit (last) stdenv; - - nativeTools = false; - nativeLibc = false; - inherit buildPackages coreutils gnugrep binutils; - libc = last.pkgs.darwin.Libsystem; - isClang = true; - cc = { name = "clang-9.9.9"; outPath = bootstrapTools; }; - }; - thisStdenv = import ../generic { inherit config shell extraNativeBuildInputs extraBuildInputs; allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [ - cc.expand-response-params cc.binutils + thisStdenv.cc.expand-response-params ]; name = "stdenv-darwin-boot-${toString step}"; @@ -105,9 +75,24 @@ in rec { hostPlatform = localSystem; targetPlatform = localSystem; - inherit cc; + cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper { + inherit shell; + inherit (last) stdenv; - preHook = lib.optionalString (shell == "${bootstrapTools}/bin/bash") '' + nativeTools = false; + nativeLibc = false; + buildPackages = lib.optionalAttrs (last ? stdenv) { + inherit (last) stdenv; + }; + libc = last.pkgs.darwin.Libsystem; + isClang = true; + cc = { name = "clang-9.9.9"; outPath = bootstrapTools; }; + binutils = { name = "binutils-9.9.9"; outPath = bootstrapTools; }; + coreutils = { name = "coreutils-9.9.9"; outPath = bootstrapTools; }; + gnugrep = { name = "gnugrep-9.9.9"; outPath = bootstrapTools; }; + }; + + preHook = stage0.stdenv.lib.optionalString (shell == "${bootstrapTools}/bin/bash") '' # Don't patch #!/interpreter because it leads to retained # dependencies on the bootstrapTools in the final stdenv. dontPatchShebangs=1 @@ -365,8 +350,8 @@ in rec { xz.out xz.bin libcxx libcxxabi gmp.out gnumake findutils bzip2.out bzip2.bin llvmPackages.llvm llvmPackages.llvm.lib zlib.out zlib.dev libffi.out coreutils ed diffutils gnutar gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk - gnugrep llvmPackages.clang-unwrapped patch pcre.out gettext - binutils-raw.binutils.out binutils-raw.binutils.dev binutils binutils.binutils + gnugrep llvmPackages.clang-unwrapped patch pcre.out binutils-raw.out + binutils-raw.dev binutils gettext cc.expand-response-params ]) ++ (with pkgs.darwin; [ dyld Libsystem CF cctools ICU libiconv locale diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 08166c55a5a9..fab1985b9765 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -143,16 +143,7 @@ in ''; }; gcc-unwrapped = bootstrapTools; - binutils = import ../../build-support/binutils-wrapper { - nativeTools = false; - nativeLibc = false; - buildPackages = { }; - libc = self.glibc; - inherit (self) coreutils gnugrep; - binutils = bootstrapTools; - name = "bootstrap-binutils-wrapper"; - stdenv = self.stdenv; - }; + binutils = bootstrapTools; coreutils = bootstrapTools; gnugrep = bootstrapTools; }; @@ -174,7 +165,7 @@ in # Rebuild binutils to use from stage2 onwards. overrides = self: super: { - binutils = super.binutils_nogold; + binutils = super.binutils.override { gold = false; }; inherit (prevStage) ccWrapperStdenv glibc gcc-unwrapped coreutils gnugrep; @@ -197,14 +188,9 @@ in overrides = self: super: { inherit (prevStage) ccWrapperStdenv - gcc-unwrapped coreutils gnugrep + binutils gcc-unwrapped coreutils gnugrep perl paxctl gnum4 bison; # This also contains the full, dynamically linked, final Glibc. - binutils = prevStage.binutils.override { - # Rewrap the binutils with the new glibc, so both the next - # stage's wrappers use it. - libc = self.glibc; - }; }; }) @@ -249,15 +235,6 @@ in # other purposes (binutils and top-level pkgs) too. inherit (prevStage) gettext gnum4 bison gmp perl glibc zlib linuxHeaders; - binutils = super.binutils.override { - # Don't use stdenv's shell but our own - shell = self.bash + "/bin/bash"; - # Build expand-response-params with last stage like below - buildPackages = { - inherit (prevStage) stdenv; - }; - }; - gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) { nativeTools = false; nativeLibc = false; @@ -322,8 +299,8 @@ in allowedRequisites = with prevStage; with lib; # Simple executable tools concatMap (p: [ (getBin p) (getLib p) ]) - [ gzip bzip2 xz bash binutils.binutils coreutils diffutils findutils - gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl + [ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk + gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl ] # Library dependencies ++ map getLib ( @@ -333,7 +310,7 @@ in # More complicated cases ++ [ glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders - binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params + gcc gcc.cc gcc.cc.lib gcc.expand-response-params ] ++ lib.optionals (system == "aarch64-linux") [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ]; diff --git a/pkgs/tools/filesystems/yandex-disk/default.nix b/pkgs/tools/filesystems/yandex-disk/default.nix index 72291ccb0061..77302f3d4a2b 100644 --- a/pkgs/tools/filesystems/yandex-disk/default.nix +++ b/pkgs/tools/filesystems/yandex-disk/default.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { $out/etc/bash_completion.d/yandex-disk-completion.bash ${patchelf}/bin/patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${zlib.out}/lib:${p.gcclib}" \ $out/bin/yandex-disk ''; diff --git a/pkgs/tools/misc/megacli/default.nix b/pkgs/tools/misc/megacli/default.nix index cf15473e2403..5341c9840be8 100644 --- a/pkgs/tools/misc/megacli/default.nix +++ b/pkgs/tools/misc/megacli/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { cd $out unzip ${src} rpmextract linux/MegaCli-8.07.07-1.noarch.rpm - ${patchelf}/bin/patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" --set-rpath ${libPath}:$out/opt/lsi/3rdpartylibs/x86_64:$out/opt/lsi/3rdpartylibs:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.cc.lib}/lib opt/MegaRAID/MegaCli/MegaCli64 + ${patchelf}/bin/patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${libPath}:$out/opt/lsi/3rdpartylibs/x86_64:$out/opt/lsi/3rdpartylibs:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.cc.lib}/lib opt/MegaRAID/MegaCli/MegaCli64 wrapProgram $out/opt/MegaRAID/MegaCli/MegaCli64 --set LD_LIBRARY_PATH $out/opt/lsi/3rdpartylibs/x86_64 ln -s $out/opt/MegaRAID/MegaCli/MegaCli64 $out/bin/MegaCli64 eval fixupPhase diff --git a/pkgs/tools/misc/ocz-ssd-guru/default.nix b/pkgs/tools/misc/ocz-ssd-guru/default.nix index 9b98ac0137cd..21786f3f15f5 100644 --- a/pkgs/tools/misc/ocz-ssd-guru/default.nix +++ b/pkgs/tools/misc/ocz-ssd-guru/default.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { cp ${system}/SSDGuru $out/bin/ rm -rf linux{32,64} patchelf \ - --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath $libPath:$out \ $out/bin/SSDGuru diff --git a/pkgs/tools/misc/sam-ba/default.nix b/pkgs/tools/misc/sam-ba/default.nix index 68675958fd3e..2d1db4eb64c7 100644 --- a/pkgs/tools/misc/sam-ba/default.nix +++ b/pkgs/tools/misc/sam-ba/default.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { mkdir -p "$out/bin/" \ "$out/opt/sam-ba/" cp -a . "$out/opt/sam-ba/" - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$out/opt/sam-ba/sam-ba${maybe64}" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/opt/sam-ba/sam-ba${maybe64}" cat > "$out/bin/sam-ba" << EOF export LD_LIBRARY_PATH="${libPath}" exec "$out/opt/sam-ba/sam-ba${maybe64}" diff --git a/pkgs/tools/misc/staruml/default.nix b/pkgs/tools/misc/staruml/default.nix index 538f9d4a9455..e1d6604970e5 100644 --- a/pkgs/tools/misc/staruml/default.nix +++ b/pkgs/tools/misc/staruml/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { mv opt/staruml $out/bin ${patchelf}/bin/patchelf \ - --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ $out/bin/StarUML mkdir -p $out/lib diff --git a/pkgs/tools/misc/xflux/default.nix b/pkgs/tools/misc/xflux/default.nix index b861c9b4d9da..d0f358446952 100644 --- a/pkgs/tools/misc/xflux/default.nix +++ b/pkgs/tools/misc/xflux/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation { cp xflux "$out/bin" ''; postFixup = '' - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) --set-rpath "$libPath" "$out/bin/xflux" + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "$libPath" "$out/bin/xflux" ''; meta = { description = "Adjusts your screen to emit warmer light at night"; diff --git a/pkgs/tools/package-management/rpm/default.nix b/pkgs/tools/package-management/rpm/default.nix index 6a9c46671282..78d815eb7c19 100644 --- a/pkgs/tools/package-management/rpm/default.nix +++ b/pkgs/tools/package-management/rpm/default.nix @@ -13,13 +13,8 @@ stdenv.mkDerivation rec { buildInputs = [ cpio zlib bzip2 file libarchive nspr nss db xz python lua pkgconfig autoreconfHook ]; - # rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as - # linkage requirements - # - # Binutils.binutils for headers - propagatedBuildInputs = [ - popt elfutils nss db bzip2 libarchive binutils binutils.binutils - ]; + # rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as linkage requirements + propagatedBuildInputs = [ popt elfutils nss db bzip2 libarchive binutils ]; NIX_CFLAGS_COMPILE = "-I${nspr.dev}/include/nspr -I${nss.dev}/include/nss"; diff --git a/pkgs/tools/security/encryptr/default.nix b/pkgs/tools/security/encryptr/default.nix index abea3eccf124..2cf07c63a84a 100644 --- a/pkgs/tools/security/encryptr/default.nix +++ b/pkgs/tools/security/encryptr/default.nix @@ -38,7 +38,7 @@ in stdenv.mkDerivation rec { cp -v lib* $out/lib ln -sv ${systemd.lib}/lib/libudev.so.1 $out/lib/libudev.so.0 - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) \ + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ --set-rpath $out/lib:${rpath} \ $out/bin/encryptr ''; diff --git a/pkgs/tools/security/enpass/default.nix b/pkgs/tools/security/enpass/default.nix index 5774de21c549..449a6911a150 100644 --- a/pkgs/tools/security/enpass/default.nix +++ b/pkgs/tools/security/enpass/default.nix @@ -73,7 +73,7 @@ let $out/share/applications/enpass.desktop for i in $out/bin/{Enpass,EnpassHelper/EnpassHelper}; do - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) $i + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i done # The helper's sha256 sum must match, hence the use of libredirect. diff --git a/pkgs/tools/security/fprot/default.nix b/pkgs/tools/security/fprot/default.nix index 0062758196f3..14a4c985d502 100644 --- a/pkgs/tools/security/fprot/default.nix +++ b/pkgs/tools/security/fprot/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { cp f-prot.conf.default $out/opt/f-prot/f-prot.conf ln -s $out/opt/f-prot/fpupdate $out/bin/fpupdate - patchelf --interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" $out/opt/f-prot/fpupdate + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/f-prot/fpupdate mkdir -p $out/share/man/ mkdir -p $out/share/man/man1 diff --git a/pkgs/tools/security/gorilla-bin/default.nix b/pkgs/tools/security/gorilla-bin/default.nix index dc99d1953d56..cbd260455d8e 100644 --- a/pkgs/tools/security/gorilla-bin/default.nix +++ b/pkgs/tools/security/gorilla-bin/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { ''; installPhase = let - interpreter = "$(< \"$NIX_BINUTILS/nix-support/dynamic-linker\")"; + interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")"; libPath = stdenv.lib.makeLibraryPath [ libXft libX11 freetype fontconfig libXrender libXScrnSaver libXext ]; in '' mkdir -p $out/opt/password-gorilla diff --git a/pkgs/tools/security/keybase-gui/default.nix b/pkgs/tools/security/keybase-gui/default.nix index 63bba05b6a09..a45a6ea2a04c 100644 --- a/pkgs/tools/security/keybase-gui/default.nix +++ b/pkgs/tools/security/keybase-gui/default.nix @@ -80,7 +80,7 @@ stdenv.mkDerivation rec { chmod +x $out/bin/keybase-gui ''; postFixup = '' - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) --set-rpath "${libPath}:\$ORIGIN" "$out/share/keybase/Keybase" + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${libPath}:\$ORIGIN" "$out/share/keybase/Keybase" ''; meta = with stdenv.lib; { diff --git a/pkgs/tools/text/xidel/default.nix b/pkgs/tools/text/xidel/default.nix index 95b8e270689f..91cecce61225 100644 --- a/pkgs/tools/text/xidel/default.nix +++ b/pkgs/tools/text/xidel/default.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p "$out/bin" cp -a usr/* "$out/" - patchelf --set-interpreter "$(cat $NIX_BINUTILS/nix-support/dynamic-linker)" "$out/bin/xidel" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/bin/xidel" ''; meta = with stdenv.lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c8ec33282113..d7071ac940ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1809,7 +1809,7 @@ with pkgs; emscripten = callPackage ../development/compilers/emscripten { }; emscriptenfastcomp-unwrapped = callPackage ../development/compilers/emscripten-fastcomp { }; - emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc stdenv.cc.binutils '' + emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc '' # hardening flags break WASM support cat > $out/nix-support/add-hardening.sh '' emscriptenfastcomp-unwrapped; @@ -5259,9 +5259,7 @@ with pkgs; clang-sierraHack = clang.override { name = "clang-wrapper-with-reexport-hack"; - binutils = clang.binutils.override { - useMacosReexportHack = true; - }; + useMacosReexportHack = true; }; clang_4 = llvmPackages_4.clang; @@ -5353,12 +5351,8 @@ with pkgs; extraBuildCommands = '' echo "dontMoveLib64=1" >> $out/nix-support/setup-hook ''; - # Binutils with glibc multi - binutils = cc.binutils.override { - libc = glibc_multi; - }; - in wrapCCWith glibc_multi binutils extraBuildCommands (cc.cc.override { - stdenv = overrideCC stdenv (wrapCCWith glibc_multi binutils "" cc.cc); + in wrapCCWith glibc_multi extraBuildCommands (cc.cc.override { + stdenv = overrideCC stdenv (wrapCCWith glibc_multi "" cc.cc); profiledCompiler = false; enableMultilib = true; })) @@ -6160,20 +6154,19 @@ with pkgs; wla-dx = callPackage ../development/compilers/wla-dx { }; - wrapCCWith = libc: binutils: extraBuildCommands: baseCC: ccWrapperFun { + wrapCCWith = libc: extraBuildCommands: baseCC: ccWrapperFun { nativeTools = stdenv.cc.nativeTools or false; nativeLibc = stdenv.cc.nativeLibc or false; nativePrefix = stdenv.cc.nativePrefix or ""; cc = baseCC; isGNU = baseCC.isGNU or false; isClang = baseCC.isClang or false; - inherit libc binutils extraBuildCommands; + inherit libc extraBuildCommands; }; ccWrapperFun = callPackage ../build-support/cc-wrapper; - binutilsWrapperFun = callPackage ../build-support/binutils-wrapper; - wrapCC = wrapCCWith stdenv.cc.libc stdenv.cc.binutils ""; + wrapCC = wrapCCWith stdenv.cc.libc ""; # legacy version, used for gnat bootstrapping wrapGCC-old = baseGCC: callPackage ../build-support/gcc-wrapper-old { nativeTools = stdenv.cc.nativeTools or false; @@ -6197,15 +6190,6 @@ with pkgs; inherit cc binutils libc shell name; }; - wrapBinutils = baseBinutils: binutilsWrapperFun { - nativeTools = stdenv.cc.nativeTools or false; - nativeLibc = stdenv.cc.nativeLibc or false; - nativePrefix = stdenv.cc.nativePrefix or ""; - libc = stdenv.cc.libc; - binutils = baseBinutils; - extraBuildCommands = ""; - }; - # prolog yap = callPackage ../development/compilers/yap { }; @@ -6766,15 +6750,13 @@ with pkgs; then darwin.binutils else binutils-raw; - binutils-raw = wrapBinutils (callPackage ../development/tools/misc/binutils { + binutils-raw = callPackage ../development/tools/misc/binutils { # FHS sys dirs presumably only have stuff for the build platform noSysDirs = (targetPlatform != buildPlatform) || noSysDirs; - }); + }; binutils_nogold = lowPrio (binutils-raw.override { - binutils = binutils-raw.binutils.override { - gold = false; - }; + gold = false; }); bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index a8c8f744d8a1..32d540a8f967 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -10,9 +10,9 @@ in apple_sdk = callPackage ../os-specific/darwin/apple-sdk { }; - binutils = pkgs.wrapBinutils (callPackage ../os-specific/darwin/binutils { + binutils = callPackage ../os-specific/darwin/binutils { inherit (darwin) cctools; - }); + }; cctools = callPackage ../os-specific/darwin/cctools/port.nix { inherit (darwin) libobjc maloader; diff --git a/pkgs/top-level/haxe-packages.nix b/pkgs/top-level/haxe-packages.nix index a79f264848b8..5a85dc3433ba 100644 --- a/pkgs/top-level/haxe-packages.nix +++ b/pkgs/top-level/haxe-packages.nix @@ -67,7 +67,7 @@ let postFixup = '' for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do chmod +w "$f" - patchelf --set-interpreter $(cat $NIX_BINUTILS/nix-support/dynamic-linker) "$f" || true + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) "$f" || true patchelf --set-rpath ${ stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] } "$f" || true done '';