Skip to content

Hadrian uses wrong stage's ghc-pkg, writing incompatible package.cache

I tried to add a field to InstalledPackageInfo.

This gave me the error:

_build/stage0/lib/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)

Full output: https://gist.github.com/nh2/94dc2f98b38798ed4a4e65844dd3ac9a

Doing _build/stage0/lib/package.conf.d/{package.cache,rts.conf} (also deleting a .conf file to work around #17467 (closed)) and re-running ./hadrian/build.stack.sh -j --flavour=quickest --verbose reveals the problem (full output):

ghc-pkg: cannot find package rts
| Run GhcPkg Copy Stage0: rts => _build/stage0/lib/package.conf.d/rts.conf
/raid/stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg --expand-pkgroot --no-user-package-db describe rts
/raid/stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg --global-package-db _build/stage0/lib/package.conf.d register -v0 -

As identified by @bgamari, it's using the global (stage0) ghc-pkg register to write the package.conf, which then of course cannot be deserialised by my modified ghc-pkg that expectes one field more.

nh2: so you're saying it should use _build/stage0/bin/ghc-pkg instead?

bgamari: right

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