Skip to content

Hadrian build failure due to out-of-date ghc-pkg cache

Recently I encountered a very peculiar failure of the Hadrian build on Windows:

 | Run Tar Extract: C:/GitLabRunner/builds/vtxL4Kke/0/ghc/ghc/libraries/ghc-bignum/gmp/gmp-tarballs/gmp-6.1.2-nodoc.tar.bz2 => C:/GitLabRunner/builds/vtxL4Kke/0/ghc/ghc/tmp/extra-dir-661891095736
# cabal-configure (for _build/stage0/libraries/hpc/setup-config)
# cabal-configure (for _build/stage0/libraries/transformers/setup-config)
# cabal-configure (for _build/stage0/libraries/binary/setup-config)
# cabal-configure (for _build/stage0/utils/deriveConstants/setup-config)
# cabal-autogen (for _build/stage0/libraries/hpc/build/autogen/cabal_macros.h)
| Run GhcPkg Dependencies Stage0: time
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
# cabal-configure (for _build/stage0/libraries/ghc-boot-th/setup-config)
# cabal-autogen (for _build/stage0/libraries/binary/build/autogen/cabal_macros.h)
| Run GhcPkg Dependencies Stage0: array
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
# cabal-configure (for _build/stage0/utils/unlit/setup-config)
| Run GhcPkg Dependencies Stage0: filepath
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
# cabal-configure (for _build/stage0/utils/touchy/setup-config)
| Run GhcPkg Dependencies Stage0: containers
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.

...

 /-----------------------------------------------------------------------------------\
| Successfully built library 'binary' (Stage0, way v).                              |
| Library: _build/stage0/libraries/binary/build/libHSbinary-0.8.8.0.a               |
| Library synopsis: Binary serialisation for Haskell values using lazy ByteStrings. |
\-----------------------------------------------------------------------------------/
| Run MergeObjects Stage0: _build/stage0/libraries/binary/build/Data/Binary.o (and 8 more) => _build/stage0/libraries/binary/build/HSbinary-0.8.8.0.o
| Configure package 'ghc-boot'
| Run Ghc CompileHs Stage0: libraries/transformers/Control/Monad/Trans/Cont.hs => _build/stage0/libraries/transformers/build/Control/Monad/Trans/Cont.o
| Run Ghc CompileHs Stage0: libraries/transformers/Control/Monad/Trans/Accum.hs => _build/stage0/libraries/transformers/build/Control/Monad/Trans/Accum.o
| Run Ghc CompileHs Stage0: libraries/transformers/Control/Monad/Trans/Select.hs => _build/stage0/libraries/transformers/build/Control/Monad/Trans/Select.o
| Run Ghc CompileHs Stage0: libraries/transformers/Control/Monad/Trans/Maybe.hs => _build/stage0/libraries/transformers/build/Control/Monad/Trans/Maybe.o
| Remove file _build/stage0/libraries/transformers/build/libHStransformers-0.5.6.2.a
| Run MergeObjects Stage0: _build/stage0/libraries/transformers/build/Control/Applicative/Backwards.o (and 25 more) => _build/stage0/libraries/transformers/build/HStransformers-0.5.6.2.o
| Run Ar Pack Stage0: _build/stage0/libraries/transformers/build/Control/Applicative/Backwards.o (and 25 more) => _build/stage0/libraries/transformers/build/libHStransformers-0.5.6.2.a
ghc-pkg.exe: cannot find package rts
C:/GitLabRunner/builds/vtxL4Kke/0/ghc/ghc/toolchain/mingw/bin/ar.exe: creating _build/stage0/libraries/transformers/build/libHStransformers-0.5.6.2.a
| Run GhcPkg Copy Stage0: rts => _build/stage0/lib/package.conf.d/rts.conf
/---------------------------------------------------------------------------------\
| Successfully built library 'transformers' (Stage0, way v).                      |
| Library: _build/stage0/libraries/transformers/build/libHStransformers-0.5.6.2.a |
| Library synopsis: Concrete functor and monad transformers.                      |
\---------------------------------------------------------------------------------/
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
| Configure package 'mtl'
| Run GhcPkg Unregister Stage0: ghc-prim => none
ghc-pkg.exe: cannot find package ghc-prim
| Run GhcPkg Copy Stage0: ghc-prim => _build/stage0/lib/package.conf.d/ghc-prim-0.5.3.conf
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
| Run GhcPkg Unregister Stage0: integer-gmp => none
ghc-pkg.exe: cannot find package integer-gmp
| Run GhcPkg Copy Stage0: integer-gmp => _build/stage0/lib/package.conf.d/integer-gmp-1.0.2.0.conf
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
| Run GhcPkg Unregister Stage0: base => none
ghc-pkg.exe: cannot find package base
| Run GhcPkg Copy Stage0: base => _build/stage0/lib/package.conf.d/base-4.13.0.0.conf
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
| Copy package 'transformers'
# cabal-copy (for _build/stage0/lib/package.conf.d/transformers-0.5.6.2.conf)
| Copy package 'ghc-boot-th'
# cabal-copy (for _build/stage0/lib/package.conf.d/ghc-boot-th-9.0.0.20200907.conf)
| Run GhcPkg Unregister Stage0: filepath => none
| Register package 'ghc-boot-th'
# cabal-register (for _build/stage0/lib/package.conf.d/ghc-boot-th-9.0.0.20200907.conf)
ghc-pkg.exe: cannot find package filepath
| Run GhcPkg Copy Stage0: filepath => _build/stage0/lib/package.conf.d/filepath-1.4.2.1.conf
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
| Register package 'transformers'
# cabal-register (for _build/stage0/lib/package.conf.d/transformers-0.5.6.2.conf)
| Run GhcPkg Unregister Stage0: array => none
ghc-pkg.exe: cannot find package array
| Run GhcPkg Copy Stage0: array => _build/stage0/lib/package.conf.d/array-0.5.4.0.conf
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
# cabal-configure (for _build/stage0/libraries/template-haskell/setup-config)
| Run GhcPkg Unregister Stage0: deepseq => none
ghc-pkg.exe: cannot find package deepseq
| Run GhcPkg Copy Stage0: deepseq => _build/stage0/lib/package.conf.d/deepseq-1.4.4.0.conf
# cabal-configure (for _build/stage0/libraries/mtl/setup-config)
WARNING: cache is out of date: C:\GitLabRunner\builds\vtxL4Kke\0\ghc\ghc\toolchain\lib\package.conf.d\package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
deepseq-1.4.4.0: dependency "array-0.5.4.0" doesn't exist (use --force to override)
Error when running Shake build system:
  at want, called at src\Main.hs:102:30 in main:Main
* Depends on: binary-dist
  at apply1, called at src\Development\Shake\Internal\Rules\Rerun.hs:41:5 in shake-0.18.5-5c5a2678b4e222fe0423eb619b23d368e31f3b1b:Development.Shake.Internal.Rules.Rerun
* Depends on: binary-dist-dir
  at need, called at src\Rules\BinaryDist.hs:119:9 in main:Rules.BinaryDist
* Depends on: _build/stage1/lib/package.conf.d/rts-1.0.conf
  at apply1, called at src\Development\Shake\Internal\Rules\Oracle.hs:159:32 in shake-0.18.5-5c5a2678b4e222fe0423eb619b23d368e31f3b1b: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/bin/ghc.exe
  at need, called at src\Rules\Register.hs:79:5 in main:Rules.Register
* Depends on: _build/stage0/lib/x86_64-windows-ghc-8.8.4/hpc-0.6.1.0/libHShpc-0.6.1.0.a
  at need, called at src\Rules\Library.hs:45:5 in main:Rules.Library
* Depends on: _build/stage0/lib/package.conf.d/hpc-0.6.1.0.conf
  at need, called at src\Rules\Register.hs:116:5 in main:Rules.Register
* Depends on: _build/stage0/lib/package.conf.d/deepseq-1.4.4.0.conf
  at cmd', called at src\Builder.hs:271:21 in main:Builder
  at cmd, called at src\Builder.hs:375:8 in main:Builder
* Raised the exception:
Development.Shake.cmd, system command failed
Command line: C:/GitLabRunner/builds/vtxL4Kke/0/ghc/ghc/toolchain/bin/ghc-pkg.exe --global-package-db _build/stage0/lib/package.conf.d register -v0 -
Exit code: 1
Stderr and Stdout:
deepseq-1.4.4.0: dependency "array-0.5.4.0" doesn't exist (use --force to override)
hadrian/build-cabal --flavour=validate -j4 --broken-test= --bignum=gmp --docs=no-sphinx --skip-perf binary-dist failed

It is not at all clear to me where things went off the rails. I don't see any references to GhcPkg in the build log prior to the the excerpt given above.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information