hadrian *default* build fails without global `xhtml` package in rare configurations
Summary
Hadrian's default build (that is, without explicit target) fails when the boot compiler doesn't have the xhtml
package. This is due to the fact that haddock
is built at stage 0, even though it's not required for normal installs.
Steps to reproduce
(sudo... use your own judgement?) ghc-pkg unregister xhtml
./boot && ./configure && ./hadrian/build -j --flavour=quickest --build-root=_build
Rather than building ghc
, this results in a build failure complaining about missing xhtml
when building haddock
:
| Configure package 'haddock'
# cabal-configure (for _build/stage0/ghc/setup-config)
# cabal-configure (for _build/stage0/utils/haddock/setup-config)
hadrian: Encountered missing or private dependencies:
xhtml ==3000.2.*
Error when running Shake build system:
at action, called at src/Rules.hs:40:19 in main:Rules
at need, called at src/Rules.hs:62:5 in main:Rules
* Depends on: _build/stage0/bin/haddock
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.18.5-602f2cdbd3147204d88e77f8741bf241686d3245c138659b0f8f659103b171f2:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage0, package = Package {pkgType = Program, pkgName = "haddock", pkgPath = "utils/haddock"}, way = v}))
at need, called at src/Hadrian/Oracles/Cabal/Rules.hs:53:9 in main:Hadrian.Oracles.Cabal.Rules
* Depends on: _build/stage0/utils/haddock/setup-config
* Raised the exception:
ExitFailure 1
Background
I believe this is a niche case; the binary distributions of GHC include the xhtml
package. I got into this situation because I habitually build GHC from source, and without documentation, so it gets installed without haddock
and hence without the xhtml
library (at least when using make
).
Observations
- The
make
based build system copes with this situation (but it doesn't seem to associatehaddock
with a stage at all). - If I install
xhtml
(cabal v1-install --global xhtml
) then the build succeeds. - There is no
xhtml
package in_build/stage0/lib/package.conf.d/
in either case, soxhtml
must be picked up as a global package.
Environment
- GHC version used: 8.8.3 or 8.10.1 without
xhtml
package - Operating System: Linux
Related
- #18094
- #17986 (closed) (though that one is about the stage1 namespace while this issue is only about the stage0 namespace)