Fails to build with hadrian on GNU/Hurd
Summary
Since version 9.4.7-1, ghc fails to build on the GNU/Hurd port of Debian, see https://buildd.debian.org/status/fetch.php?pkg=ghc&arch=hurd-i386&ver=9.4.7-1&stamp=1697717885&raw=0
This seems to coincide with the use in Debian of hadrian
to build ghc.
Steps to reproduce
One just needs to try to build the ghc package on a Debian GNU/Hurd box.
Expected behavior
It should just build
Obtained behavior
The end of the log reads:
/usr/bin/ar: creating _build/stage0/libraries/ghc-boot-th/build/libHSghc-boot-th-9.4.7.a
/----------------------------------------------------------------------------------------\
| Successfully built library 'ghc-boot-th' (Stage0 InTreeLibs, way v). |
| Library: _build/stage0/libraries/ghc-boot-th/build/libHSghc-boot-th-9.4.7.a |
| Library synopsis: Shared functionality between GHC and the @template-haskell@
library. |
\----------------------------------------------------------------------------------------/
| Configure package 'template-haskell'
| Copy package 'ghc-boot-th'
# cabal-copy (for _build/stage0/lib/package.conf.d/ghc-boot-th-9.4.7.conf)
| Register package 'ghc-boot-th'
# cabal-register (for _build/stage0/lib/package.conf.d/ghc-boot-th-9.4.7.conf)
Error when running Shake build system:
at want, called at src/Main.hs:124:44 in main:Main
* Depends on: binary-dist-dir
at need, called at src/Rules/BinaryDist.hs:130:9 in main:Rules.BinaryDist
* Depends on: _build/stage1/lib/package.conf.d/rts-1.0.2.conf
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.19.7-8aOUgMv3zeLJ3ZqsiH3Cgu:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "rts", pkgPath = "rts"}, way = v}))
at need, called at src/Hadrian/Oracles/Cabal/Rules.hs:54:9 in main:Hadrian.Oracles.Cabal.Rules
* Depends on: _build/stage1/rts/setup-config
at need, called at src/Hadrian/Builder.hs:80:9 in main:Hadrian.Builder
* Depends on: _build/stage0/bin/ghc
at need, called at src/Rules/Register.hs:80:5 in main:Rules.Register
* Depends on: _build/stage0/lib/i386-gnu-ghc-9.4.6/ghc-boot-th-9.4.7/libHSghc-boot-th-9.4.7.a
at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shake-0.19.7-8aOUgMv3zeLJ3ZqsiH3Cgu:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, rule finished running but did not produce file:
_build/stage0/lib/i386-gnu-ghc-9.4.6/ghc-boot-th-9.4.7/libHSghc-boot-th-9.4.7.a
and indeed, what did get produce was rather _build/stage0/lib/i386-hurd-ghc-9.4.6/ghc-boot-th-9.4.7/libHSghc-boot-th-9.4.7.a
(i386-hurd
instead of i386-gnu
).
Proposed fix
This is due to confusion between hurd
and gnu
in various places. Apparently previous versions of ghc were using gnu
for the GNU/Hurd port, and thus putting libraries etc. in i386-gnu
, but here some part of the build system thinks it should rather be i386-hurd
.
I have submitted a merge request against Cabal that fixes this, it got merged:
https://github.com/haskell/cabal/pull/9434
Now we need the converse in Hadrian, I will submit a merge request.
Environment
- GHC version used: 9.4.7
Optional:
- Operating System: GNU/Hurd
- System Architecture: i386