Hadrian is fragile in the presence of disappearing files
Today I found that a build with Hadrian failed due to a stale includes/ghcplatform.h
produced by the make
build system. To fix this I deleted the stale file and tried re-running Hadrian. To my surprise, the build then failed with:
$ hadrian/build.cabal.sh -j9
Up to date
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/ctz.c => _build/stage1/libraries/ghc-prim/build/c/cbits/ctz.o.d
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/popcnt.c => _build/stage1/libraries/ghc-prim/build/c/cbits/popcnt.dyn_o.d
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/word2float.c => _build/stage1/libraries/ghc-prim/build/c/cbits/word2float.dyn_o.d
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/pdep.c => _build/stage1/libraries/ghc-prim/build/c/cbits/pdep.dyn_o.d
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/ctz.c => _build/stage1/libraries/ghc-prim/build/c/cbits/ctz.dyn_o.d
| Run Cc FindCDependencies Stage1: libraries/ghc-prim/cbits/bswap.c => _build/stage1/libraries/ghc-prim/build/c/cbits/bswap.dyn_o.d
Error when running Shake build system:
at action, called at src/Rules.hs:71:19 in main:Rules
at need, called at src/Rules.hs:93:5 in main:Rules
* Depends on: _build/stage1/lib/package.conf.d/unix-2.7.2.2.conf
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "unix", pkgPath = "libraries/unix"}, way = v}))
* Depends on: _build/stage1/libraries/unix/setup-config
* Depends on: _build/stage1/lib/package.conf.d/time-1.9.3.conf
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "time", pkgPath = "libraries/time"}, way = v}))
* Depends on: _build/stage1/libraries/time/setup-config
* Depends on: _build/stage1/lib/package.conf.d/deepseq-1.4.4.0.conf
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "deepseq", pkgPath = "libraries/deepseq"}, way = v}))
* Depends on: _build/stage1/libraries/deepseq/setup-config
* Depends on: _build/stage1/lib/package.conf.d/ghc-prim-0.6.1.conf
* Depends on: _build/stage1/libraries/ghc-prim/build/libHSghc-prim-0.6.1.a
* Depends on: _build/stage1/libraries/ghc-prim/build/c/cbits/ctz.o
* Depends on: includes/ghcplatform.h
at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shake-0.18.3-a9de361a74bef613491c235c1a1f725e6f3f1e9824ca9a8fbdfa98ba6ccae272:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, file does not exist and no rule available:
includes/ghcplatform.h
Even find _build/stage1 -iname *.d -a -type f -delete
seems not to resolve the issue. Ultimately I ended up deleting _build/hadrian/.shake.database
and rebuilding.
This highlights a theme that I've encountered a few times while using Hadrian: it seems to keep a fair amount of internal state but provides no way to invalidate this state when things go awry.