Describe the bug
The cc-wrapper invokes mktemp with the --tmpdir flag, which is not supported on MacOS.
Steps To Reproduce
I do not have a short reproducer. However, the issue was observed on this GitHub actions CI run in a cgo context.
# runtime/cgo
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
The issue can be resolved by applying the following change to cc-wrapper.sh:
@@ -246,7 +246,7 @@ 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 cc-params.XXXXXX)
+ responseFile=$(mktemp "${TMPDIR:-/tmp}/cc-params.XXXXXX")
trap 'rm -f -- "$responseFile"' EXIT
printf "%q\n" \
${extraBefore+"${extraBefore[@]}"} \
Expected behavior
The mktemp error should not have occurred. The code under test used to work, and failed after an update of the nixpkgs revision in use from ea4c80b to 6500b45.
Screenshots
n/a
Additional context
The commit range includes the following two commits that touch on mktemp:
- 520a544 adds
mktemp --tmpdir to the strip setup-hook
- 6f2b3ba adds
mktemp --tmpdir to the cc-wrapper for response file handling
The latter one seems to be the cause of the issue.
Similar issues were described in #254104 (comment) and numtide/devshell#10 (comment).
Notify maintainers
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-darwin"`
- host os: `Darwin 21.6.0, macOS 12.6.3`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.3`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
Describe the bug
The
cc-wrapperinvokesmktempwith the--tmpdirflag, which is not supported on MacOS.Steps To Reproduce
I do not have a short reproducer. However, the issue was observed on this GitHub actions CI run in a cgo context.
The issue can be resolved by applying the following change to
cc-wrapper.sh:Expected behavior
The
mktemperror should not have occurred. The code under test used to work, and failed after an update of the nixpkgs revision in use from ea4c80b to 6500b45.Screenshots
n/a
Additional context
The commit range includes the following two commits that touch on
mktemp:mktemp --tmpdirto the strip setup-hookmktemp --tmpdirto the cc-wrapper for response file handlingThe latter one seems to be the cause of the issue.
Similar issues were described in #254104 (comment) and numtide/devshell#10 (comment).
Notify maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"and paste the result.