GHC 9.2.7 on FreeBSD - HSC2HS_EXTRA issue
baulig at protonmail.com
Mon Mar 20 02:05:16 UTC 2023
I am a FreeBSD user, running FreeBSD 13.1 with Clang 13 and GCC 12.2, and still fairly new to the Haskell Platform.
When I tried to upgrade a hobby project to Stackage's latest LTS 20.15, I realized that neither the GHC 9.2.6 nor
the GHC 9.2.7 binary packages from GHCUP work anymore.
There are two issues - and I wrote a detailed article about my investigation on Medium:
The first one is a trivial one-line change - in hadrian/src/Rules/BinaryDist.hs, we need to change
> ( "HSC2HS_EXTRA=\"" <> unwords ccArgs <> unwords ldFlags <> "\""
> ( "HSC2HS_EXTRA=\"" <> unwords (ccArgs <> ldFlags) <> "\""
Otherwise, this will break when both ccArgs and ldFlags are non-empty:
> HSC2HS_EXTRA="--cflag=--target=x86_64-portbld-freebsd--lflag=--target=x86_64-portbld-freebsd --lflag=-fuse-ld=lld"
Unfortunately, this is not quite it just yet.
The problem is that Clang supports the --target= argument, but GCC does not - and it looks like Cabal insists on always
invoking hsc2hs with an explicit --cc= argument.
Overriding that in ~/.cabal/config doesn't work either - because then Cabal passes "-pgmc /usr/bin/cc" to GHC, but no
"-pgma" and GHC tries to invoke GCC for assembling with a Clang-only argument.
I am a bit lost here now about what the correct path forward is, but would very much like to help fixing this problem,
so I created an account on gitlab.haskell.org to report this issue, but got a message saying that it is awaiting admin
approval. Looking a bit further in the documentation for new contributors, I saw a comment suggesting I should
post on this mailing list and ask for approval. Could an admin please have a look at that? My user name is my last
name in lowercase, baulig.
Looking forward to hear back from you,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs