Skip to content

Hadrian: stage 1 GHC doesn't use the right package db by default

Summary

_build/stage0/bin/ghc doesn't hit the right package database (_build/stage1/lib/package.conf.d) by default. Compiling the simplest program (say, main = return () in a file blah.hs) without package-db related CLI flags is not possible.

The interface file it actually hits is my boot (stage 0) compiler's.

Steps to reproduce

$ cat blah.hs
main = return ()

$ _build/stage0/bin/ghc blah.hs -o blah
[1 of 1] Compiling Main             ( blah.hs, blah.o )

blah.hs:1:1: error:
    Bad interface file: /nix/store/d9syi687jirk386a9hgr96yqhw6mx243-ghc-8.4.4/lib/ghc-8.4.4/base-4.11.1.0/Prelude.hi
        mismatched interface file versions (wanted "80920190315", got "8044")
  |
1 | main = return ()

Expected behavior

The above command works, by virtue of having _build/stage0/bin/ghc hit _build/stage1/lib/package.conf.d all by itself, instead of the boot GHC's package db.

Environment

  • GHC version used: 8.4.4 as my boot compiler, but the problem is against HEAD.

Optional:

  • Operating System: Reproduced on Windows and Linux
  • System Architecture: x86_64

cc @snowleopard

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