please help with ghc package-db flags

Norman Ramsey nr at cs.tufts.edu
Mon Sep 27 20:50:42 UTC 2021


I've traced some troubles to a problem with GHC's response
to the -clear-package-db and -package-db flags.  I would very much
like to know if others can duplicate this issue.

All that is needed is for you to try the following commands, or
whatever variations may be appropriate for whatever ghc versions you
have installed on your system:

  ghc-pkg init /tmp/empty-package-db
  ghc        -clear-package-db -package-db /tmp/empty-package-db/ -v
  ghc-9.0.1  -clear-package-db -package-db /tmp/empty-package-db/ -v
  ghc-8.10.7 -clear-package-db -package-db /tmp/empty-package-db/ -v

On my system at this present moment, ghc-8.10.7 respects the commands,
but ghc-9.0.1 does not.  The output from the `-v` options show what's
happening: if GHC finds any packages that are *not* "wired-in," then
something is broken.  As examples, I attach the sample outputs from my
own system.

I think the issue is being caused by something mysterious in my filesystem.
Last Friday, ghc 9.0.1 was respecting those flags.  But today it is not.
Before I try to figure out what is going on, I would *very* much
appreciate learning if anyone else can duplicate the issue.

Please try running GHC with an empty package database and let me know
what happens.


Norman
-------------- next part --------------
nr at homedog ~> ghc-8.10.7 -v -clear-package-db -package-db $STAGE1/lib/package.conf.d -v
Glasgow Haskell Compiler, Version 8.10.7, stage 2 booted by GHC version 8.10.4
*** initializing package database:
Using binary package database: /home/nr/asterius/ghc/_build/stage1/lib/package.conf.d/package.cache
package flags []
loading package database /home/nr/asterius/ghc/_build/stage1/lib/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.8.0
wired-in package integer-wired-in mapped to integer-gmp-1.1
wired-in package base mapped to base-4.16.0.0
wired-in package rts mapped to rts-1.0.2
wired-in package template-haskell mapped to template-haskell-2.18.0.0
wired-in package ghc mapped to ghc-9.3
!!! initializing package database: finished in 7.82 milliseconds, allocated 8.501 megabytes
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghc: no input files
Usage: For basic information, try the `--help' option.
nr at homedog ~ [1]> ghc-9.0.1 -v -clear-package-db -package-db $STAGE1/lib/package.conf.d -v
Loaded package environment from /home/nr/.ghc/x86_64-linux-9.0.1/environments/default
Glasgow Haskell Compiler, Version 9.0.1, stage 2 booted by GHC version 8.8.3
*** initializing unit database:
Using binary package database: /home/nr/.ghcup/ghc/9.0.1/lib/ghc-9.0.1/package.conf.d/package.cache
Using binary package database: /home/nr/.cabal/store/ghc-9.0.1/package.db/package.cache
package flags [-package-id ghc-9.0.1{unit ghc-9.0.1 True ([])},
               -package-id bytestring-0.10.12.1{unit bytestring-0.10.12.1 True ([])},
               -package-id unix-2.7.2.2{unit unix-2.7.2.2 True ([])},
               -package-id base-4.15.0.0{unit base-4.15.0.0 True ([])},
               -package-id time-1.9.3{unit time-1.9.3 True ([])},
               -package-id hpc-0.6.1.0{unit hpc-0.6.1.0 True ([])},
               -package-id filepath-1.4.2.1{unit filepath-1.4.2.1 True ([])},
               -package-id process-1.6.11.0{unit process-1.6.11.0 True ([])},
               -package-id array-0.5.4.0{unit array-0.5.4.0 True ([])},
               -package-id integer-gmp-1.1{unit integer-gmp-1.1 True ([])},
               -package-id containers-0.6.4.1{unit containers-0.6.4.1 True ([])},
               -package-id ghc-boot-9.0.1{unit ghc-boot-9.0.1 True ([])},
               -package-id binary-0.8.8.0{unit binary-0.8.8.0 True ([])},
               -package-id ghc-prim-0.7.0{unit ghc-prim-0.7.0 True ([])},
               -package-id ghci-9.0.1{unit ghci-9.0.1 True ([])},
               -package-id rts{unit rts True ([])},
               -package-id terminfo-0.4.1.4{unit terminfo-0.4.1.4 True ([])},
               -package-id transformers-0.5.6.2{unit transformers-0.5.6.2 True ([])},
               -package-id deepseq-1.4.5.0{unit deepseq-1.4.5.0 True ([])},
               -package-id ghc-boot-th-9.0.1{unit ghc-boot-th-9.0.1 True ([])},
               -package-id pretty-1.1.3.6{unit pretty-1.1.3.6 True ([])},
               -package-id template-haskell-2.17.0.0{unit template-haskell-2.17.0.0 True ([])},
               -package-id directory-1.3.6.1{unit directory-1.3.6.1 True ([])},
               -package-id text-1.2.4.1{unit text-1.2.4.1 True ([])},
               -package-id ghc-paths-0.1.0.12-3f4623015bdeee15e2d2cf4307a5331bbd2d0c0ee8ac137a5857a6db6f44b0cc{unit ghc-paths-0.1.0.12-3f4623015bdeee15e2d2cf4307a5331bbd2d0c0ee8ac137a5857a6db6f44b0cc True ([])}]
loading package database /home/nr/.ghcup/ghc/9.0.1/lib/ghc-9.0.1/package.conf.d
loading package database /home/nr/.cabal/store/ghc-9.0.1/package.db
wired-in package ghc-prim mapped to ghc-prim-0.7.0
wired-in package ghc-bignum mapped to ghc-bignum-1.0
wired-in package base mapped to base-4.15.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.17.0.0
wired-in package ghc mapped to ghc-9.0.1
!!! initializing unit database: finished in 15.03 milliseconds, allocated 12.331 megabytes
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghc: no input files
Usage: For basic information, try the `--help' option.


More information about the ghc-devs mailing list