Skip to content

Suppress cc-wrapper --target mismatch warning on aarch64-darwin#237

Merged
angerman merged 1 commit into
mainfrom
fix/suppress-cc-wrapper-target-warning
Feb 27, 2026
Merged

Suppress cc-wrapper --target mismatch warning on aarch64-darwin#237
angerman merged 1 commit into
mainfrom
fix/suppress-cc-wrapper-target-warning

Conversation

@angerman
Copy link
Copy Markdown
Collaborator

Summary

  • Set NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING=1 in the env script before sourcing stdenv/setup
  • Prevents nix cc-wrapper from emitting a noisy --target aarch64-apple-darwin != arm64-apple-darwin warning on every compiler invocation on aarch64-darwin
  • Fixes thousands of GHC testsuite failures caused by unexpected stderr output from the cc-wrapper

Context

GNU config.sub normalises the Apple AArch64 triple to aarch64-apple-darwin, while Apple's LLVM toolchain and nix cc-wrapper's @defaultTarget@ use arm64-apple-darwin. Older GHC versions (without stable-haskell/ghc#149) pass --target=aarch64-apple-darwin to the compiler, triggering the warning.

The warning itself is harmless — clang handles both triples identically — but it pollutes stderr and causes 5,400+ GHC testsuite failures due to unexpected compiler output.

A companion fix in GHC's ghc-toolchain (PR #149) normalises the LLVM target at build-system level, but this devx-level fix is needed for older GHC versions that don't have that change.

Test plan

  • nix flake check --no-build passes (pre-existing store-path issues only)
  • Built ghc98-minimal-env script and verified it contains the export
  • GHC CI on aarch64-darwin no longer shows the --target mismatch warning

GNU config.sub normalises to "aarch64-apple-darwin" while Apple's
LLVM toolchain (and nix cc-wrapper's @defaultTarget@) uses
"arm64-apple-darwin". Older GHC versions pass --target=aarch64-apple-darwin
which triggers a noisy warning from the cc-wrapper's
add-clang-cc-cflags-before hook on every compiler invocation.

The warning is harmless — clang handles both triples identically — but
it pollutes stderr and causes thousands of GHC testsuite failures due
to unexpected compiler output.

Set NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING=1 in the env script before
sourcing stdenv/setup to suppress this warning.
@angerman angerman added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit ac635ef Feb 27, 2026
886 of 894 checks passed
@angerman angerman deleted the fix/suppress-cc-wrapper-target-warning branch February 27, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant