fix(ghc): address cc-wrapper warning on darwin #391975
Draft
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.
on
aarch64-darwin
, ghc passes the target flag through asarm64-apple-darwin
. this doesn't match the targetPlatform, so the check fails in cc-wrapper. the warning is spammy but of greater note is the indication in these PRs that this check should become a hard error as usingcc-wrapper
for a cross-compiler causes breakages.see:
--target
option is used on a wrapped compiler #323869this check is likely to be made into a hard error at some point, so we should address it in the ghc build.
I've fixed this by having hadrian unconditionally set the target (addressing a TODO item in
common-hadrian.nix
) and modifying the name of the target inllvm-targets
when building onaarch64-darwin
. we already pass--target
to configure ifconfigurePlatforms
includestarget
, so I've also ensured we set it there.lastly, when
useLLVM
is set, we additionally need to make sure the LLVM target is configured or GHC ignores the target flags and passes the wrong target through anyway. so I've ensured we set theLlvmTarget
andbootstrap_llvm_target
configure variables.this PR does not address the bindists. I don't know if the problem /can/ be solved there as GHC's configuration is set upstream for those -- setting
bootPkgs
to one of the bindists 1) produces the warning and 2) trying to add the same configuration settings for those compilers makes stage 0 compilation fail as the setting doesn't match the compiler's prebaked configuration. perhaps there's a way around this, I don't know.I haven't tested yet on linux, will do as soon as I get a chance. I've also only tested this with 9.10.1. I'm not sure compiling literally every haskell package is feasible on my laptop but I will update as I get more tested. I'll switch this to "Ready for Review" when I feel I've tested as much as I can.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)