fix(ghc): address cc-wrapper warning on darwin#391975
fix(ghc): address cc-wrapper warning on darwin#391975cassandracomar wants to merge 1 commit intoNixOS:haskell-updatesfrom
Conversation
on `aarch64-darwin`, ghc passes the target flag through as `arm64-apple-darwin`. this doesn't match the hostPlatform, so the check fails in cc-wrapper. see: - NixOS#379593 - NixOS#323869 this 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 in `llvm-targets` when building on `aarch64-darwin`. we already pass `--target` to configure if `configurePlatforms` includes `target`, 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 the `LlvmTarget` and `bootstrap_llvm_target` configure variables.
|
oh, tangential note for anyone building ghc on darwin -- the compiler config in |
I'm doing something related in 02662cb, which also leads to passing target unconditionally. Have not tested your approach here, yet - just wanted to mention it for now. |
|
haven't been able to test linux due to the massive recompilation required on my laptop but I will handle the merge conflict this week. |
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-wrapperfor a cross-compiler causes breakages.see:
--targetoption 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-targetswhen building onaarch64-darwin. we already pass--targetto configure ifconfigurePlatformsincludestarget, so I've also ensured we set it there.lastly, when
useLLVMis 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 theLlvmTargetandbootstrap_llvm_targetconfigure 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
bootPkgsto 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 = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)