cc-wrapper: Unconditionally warn about skipped native flags #203675
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
This PR makes
cc-wrapper
warn about skippednative
flags (e.g.,-march=native
) unconditionally, so the behavior is more visible for users using the wrapped compilers in a Nix shell environment where they would expect such flags to work.Currently,
cc-wrapper
strips out such flags silently whenNIX_ENFORCE_NO_NATIVE
is enabled (the default instdenv
). A message is only emitted ifNIX_DEBUG
is set. This makes sense for reproduciblility, but the behavior can be surprising/undesirable to users using it interactively. The compiler shouldn't silently not do what is specified without informing the user.The downside of adding such an unconditional warning is log spam during builds that specify any
native
flag. However, we should fix the affected packages to not use such flags in the first place. Currently, a full build ofstdenv
with this PR applied does not emit such warnings.Alternative solutions
cc-wrapper
simply exit with a non-zero code when such flags are passed andNIX_ENFORCE_NO_NATIVE
is enabled. This will probably break some packages, but is a cleaner solution.mkShell
environment not haveNIX_ENFORCE_NO_NATIVE
.Workarounds
NIX_CFLAGS_COMPILE=-march=native
produces the expected result since the flags are appended after filtering, but the effect pollutes the entire shell/build environment.Things done
stdenv
on master)sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes