diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 4cc661721f44..a539f9da4318 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -251,8 +251,8 @@ if [[ -e @out@/nix-support/cc-wrapper-hook ]]; then fi if (( "${NIX_CC_USE_RESPONSE_FILE:-@use_response_file_by_default@}" >= 1 )); then - responseFile=$(mktemp "${TMPDIR:-/tmp}/cc-params.XXXXXX") - trap 'rm -f -- "$responseFile"' EXIT + responseFile=$(@mktemp@ "${TMPDIR:-/tmp}/cc-params.XXXXXX") + trap '@rm@ -f -- "$responseFile"' EXIT printf "%q\n" \ ${extraBefore+"${extraBefore[@]}"} \ ${params+"${params[@]}"} \ diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 085f64d37dd4..b9def8632615 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -743,6 +743,8 @@ stdenvNoCC.mkDerivation { # TODO(@sternenseemann): rename env var via stdenv rebuild shell = getBin runtimeShell + runtimeShell.shellPath or ""; gnugrep_bin = optionalString (!nativeTools) gnugrep; + rm = if nativeTools then "rm" else lib.getExe' coreutils "rm"; + mktemp = if nativeTools then "mktemp" else lib.getExe' coreutils "mktemp"; # stdenv.cc.cc should not be null and we have nothing better for now. # if the native impure bootstrap is gotten rid of this can become `inherit cc;` again. cc = optionalString (!nativeTools) cc; diff --git a/pkgs/test/cc-wrapper/default.nix b/pkgs/test/cc-wrapper/default.nix index 9e25be460e25..61d65784f5b9 100644 --- a/pkgs/test/cc-wrapper/default.nix +++ b/pkgs/test/cc-wrapper/default.nix @@ -131,6 +131,9 @@ in stdenv.mkDerivation { ASAN_OPTIONS=use_sigaltstack=0 ${emulator} ./sanitizers ''} + echo "Check whether CC with NIX_CC_USE_RESPONSE_FILE hardcodes all required binaries..." >&2 + NIX_CC_USE_RESPONSE_FILE=1 ${CC} -v + touch $out '';