Improve Hadrian feedback when the boot compiler changes
Motivation
When updating ghc.nix
, the boot compiler can be updated (most recently from 8.6 to 8.8), thus producing a build error that is
most obscure to the non-initiated:
error logs
hadrian: ghc-pkg dump failed: dieVerbatim: user error (hadrian:
'/nix/store/vysnbfiax8xyanbimqw6ag70z41nk5dd-ghc-8.8.2/bin/ghc-pkg'
exited with an error:
ghc-pkg: _build/stage0/lib/package.conf.d/package.cache:
GHC.PackageDb.readPackageDb: inappropriate type (not enough bytes)
)
interrupted!
Error when running Shake build system:
at want, called at src/Main.hs:92:30 in main:Main
* Depends on: docs
at need, called at src/Rules/Documentation.hs:116:9 in main:Rules.Documentation
* Depends on: _build/docs/archives/libraries.html.tar.xz
at need, called at src/Rules/Documentation.hs:331:9 in main:Rules.Documentation
* Depends on: _build/docs/html/libraries/index.html
at need, called at src/Rules/Documentation.hs:200:9 in main:Rules.Documentation
* Depends on: _build/docs/html/libraries/ghc-prim/ghc-prim.haddock
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.18.5-d08cc570254c2937656e16b0fb9ddd0ad652646c7554b15bb3ec273551ad685b:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "ghc-prim", pkgPath = "libraries/ghc-prim"}, way = v}))
at need, called at src/Hadrian/Oracles/Cabal/Rules.hs:53:9 in main:Hadrian.Oracles.Cabal.Rules
* Depends on: _build/stage1/libraries/ghc-prim/setup-config
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.18.5-d08cc570254c2937656e16b0fb9ddd0ad652646c7554b15bb3ec273551ad685b: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:53:9 in main:Hadrian.Oracles.Cabal.Rules
* Depends on: _build/stage1/rts/setup-config
at need, called at src/Hadrian/Builder.hs:70:5 in main:Hadrian.Builder
* Depends on: _build/stage0/lib/bin/unlit
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.18.5-d08cc570254c2937656e16b0fb9ddd0ad652646c7554b15bb3ec273551ad685b:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage0, package = Package {pkgType = Program, pkgName = "unlit", pkgPath = "utils/unlit"}, way = v}))
* Depends on: _build/stage0/utils/unlit/setup-config
* Raised the exception:
ExitFailure 1
Indeed, it is not enough to re-run ./boot
and ./configure
, but _build
also needs to be erased.
As advised by @alp, I am writing this ticket to suggest an improvement in that direction.
Proposal
In order to streamline the development process on GHC, Hadrian should be able to remove conflicting build artifacts upon the change of a boot compiler.
Clearly its (current) inability to do so indicates that some dependencies are missing to incorporate this particular kind of knowledge in Hadrian.