diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 74570a9d2575..6d9780b3913c 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -126,6 +126,7 @@ let libc_dev = optionalString (libc != null) (getDev libc); libc_lib = optionalString (libc != null) (getLib libc); cc_solib = getLib cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}"; + cc_bin = getBin cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}"; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. coreutils_bin = optionalString (!nativeTools) (getBin coreutils); @@ -590,15 +591,21 @@ stdenvNoCC.mkDerivation { ] ++ optional (cc.langC or true) ./setup-hook.sh ++ optional (cc.langFortran or false) ./fortran-hook.sh - ++ optional (targetPlatform.isWindows) ( + ++ optional (targetPlatform.isWindows || targetPlatform.isCygwin) ( stdenvNoCC.mkDerivation { name = "win-dll-hook.sh"; dontUnpack = true; - installPhase = '' - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out - ''; + installPhase = + if targetPlatform.isCygwin then + '' + echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_bin}/lib" >> $out + '' + else + '' + echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out + echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out + echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out + ''; } );