Fix --host= triple mangling during cross-compilation#11718
Fix --host= triple mangling during cross-compilation#11718jappeace wants to merge 9 commits intohaskell:masterfrom
Conversation
issue: haskell#5887 I don't like you've to use nix to cross compile, cabal should be able to do this.
4bdfae3 to
fb2cc4c
Compare
|
This touches setup hooks, so I'm asking @sheaf to review. |
What? This has nothing to do with SetupHooks. |
| ++ [("PATH", Just pathEnv) | not (null extraPath)] | ||
| ++ cabalFlagEnv | ||
| maybeHostFlag = ["--host=" ++ show (pretty hp) | hp /= buildPlatform] | ||
| maybeHostFlag = ["--host=" ++ fromMaybe (show (pretty hp)) targetTriple | hp /= buildPlatform] |
There was a problem hiding this comment.
Why use the original show (pretty hp) if we know it is wrong?
This also needs a very loud comment that the hp =/ buildPlatform guard is too restrictive, e.g. for glibc -> musl cross-compilation we don't want to omit x86_64-unknown-linux-musl. But I don't know how we could find out the build triple to compare against.
| -> Maybe String | ||
| -- ^ original target triple from compiler info (e.g. @"x86_64-w64-mingw32"@), | ||
| -- used for the @--host=@ flag instead of the pretty-printed 'Platform' |
There was a problem hiding this comment.
There needs to be an explanation (or a reference to an explanation) about how the GHC target platform corresponds to the autoconf notion of host. Otherwise it looks very confusing at a first glance, i.e. it appears like we are mixing up host and target.
| let common = configCommonFlags flags | ||
| verbosity = mkVerbosity defaultVerbosityHandles (fromFlag $ setupVerbosity common) | ||
| mbWorkDir = flagToMaybe $ setupWorkingDir common | ||
| targetTriple = Map.lookup "Target platform" (compilerProperties (compiler lbi)) |
There was a problem hiding this comment.
I would call this (here and below) compilerTargetTriple just to be explicit.
| repairs (hopefully): https://github.com/haskell/cabal/issues/5887 | ||
|
|
||
| Adds an integration test which fails | ||
| on master and now succeeds. |
There was a problem hiding this comment.
Cabal now passes the unchanged GHC target platform triple as the autoconf --host, instead of a simplified version.
For example, Cabal now passes the full --host=x86_64-w64-mingw32 instead of the incorrect --host=x86_64-windows.
Co-authored-by: sheaf <sam.derbyshire@gmail.com>
surely this will make autoconf less confusing. ... my god it's horrible.
issue: #5887
significance: significantin the changelog file.I don't like it you've to use nix for cross complattion 😔