
#16228: ghc-pkg and ghc do not agree about package with internal libraries --------------------------------------+--------------------------------- Reporter: michaelpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.6.3 Keywords: | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+--------------------------------- Initially I reported this to Cabal (https://github.com/haskell/cabal/issues/5857), but I think this is actually a GHC bug. Repro here: https://github.com/michaelpj/cabal-bug-package-db In particular, you can run the following. {{{ $ cabal build $ ghc-pkg field test exposed -f dist/package.conf.inplace exposed: True $ ghc-pkg find-module Test -f dist/package.conf.inplace dist/package.conf.inplace test-0.1.0.0 $ ghc -package-db dist/package.conf.inplace Use.hs [1 of 1] Compiling Use ( Use.hs, Use.o ) Use.hs:3:1: error: Could not load module ‘Test’ It is a member of the hidden package ‘test-0.1.0.0’. You can run ‘:set -package test’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for. | 3 | import Test | ^^^^^^^^^^^ $ ghc -package-db dist/package.conf.inplace -package test Use.hs [1 of 1] Compiling Use ( Use.hs, Use.o ) }}} That is: * `ghc-pkg` thinks the package is present, exposed, and contains the module in question. * `ghc` thinks the package is hidden, and will accept it when specified with `-package`. If you comment out the internal library this does not happen, but regardless it seems bad that there's a disagreement between `ghc-pkg` and `ghc`. I've also observed (although I don't have a small reproduction for this) a similar case where `ghc` does not even think the module is hidden, but again will accept it with `-package`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16228 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler