Interrupting a Hadrian build often results in inconsistent tree
I have often found that SIGINT
'ing a Hadrian build will often leave inconsistent build artifacts around. For instance,
$ hadrian/build.cabal.sh -j9
...
| Run Ghc CompileHs Stage1: libraries/Cabal/Cabal/Distribution/Simple/GHCJS.hs => _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHCJS.p_o
[^C]
$ hadrian/build.cabal.sh -j9
...
| Run Ghc CompileHs Stage1: libraries/Cabal/Cabal/Distribution/Simple/GHCJS.hs => _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHCJS.p_o
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/Cabal-3.1.0.0.conf
at need, called at src/Rules/Register.hs:113:5 in main:Rules.Register
* Depends on: _build/stage1/libraries/Cabal/Cabal/build/libHSCabal-3.1.0.0-ghc8.11.0.20191201.so
at need, called at src/Rules/Library.hs:146:5 in main:Rules.Library
* Depends on: _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.dyn_o
at &%>, called at src/Rules/Compile.hs:54:7 in main:Rules.Compile
* Depends on: _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.dyn_o _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.dyn_hi
at error, called at src/Development/Shake/Internal/Rules/Files.hs:245:13 in shake-0.18.3-a9de361a74bef613491c235c1a1f725e6f3f1e9824ca9a8fbdfa98ba6ccae272:Development.Shak
e.Internal.Rules.Files
* Raised the exception:
Error, &%> rule failed to produce 1 file (out of 2)
_build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.dyn_o
_build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.dyn_hi - MISSING
Removing _build/stage1/libraries/Cabal/Cabal/build/Distribution/Simple/GHC.*
causes Hadrian to rebuild the affected module, fixing the inconsistency.
I would guess that this is because, unlike make
, Hadrian does not clean up targets of any in-flight builds when it is interrupted.