Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#3168 closed bug (fixed)

Unhelpful error message about "hidden" packages

Reported by: simonpj Owned by:
Priority: normal Milestone: 6.12.1
Component: Compiler Version: 6.10.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Anatoly Yakonenko reported: I am trying to build ParseP on the latest ghc, and I am getting this error:

    Could not find module `Data.ByteString.Char8':
      it is a member of package bytestring-, which is hidden

Ross Mellgren responded (correctly): I assume you're using cabal, which hides all packages by default. Add "bytestring" or "bytestring >= 0.9.*" or something along those lines to Build-Depends in your .cabal file.

Suggestion: improve GHC's error message.

Change History (4)

comment:1 Changed 7 years ago by simonpj

  • difficulty changed from Unknown to Easy (1 hr)
  • Milestone set to 6.12.1

I think this is readily fixable. Line 601 of Finder.lhs has

    pkg_hidden pkg =
        ptext (sLit "it is a member of the hidden package") <+> quotes (ppr pkg)

I suggest instead:

  "Since it is a member of package bytestring-, 
   perhaps you intended to say '-package bytestring', 
   or (if using Cabal) perhaps you omitted 'bytestring' from the
   build-depends in your .cabal file."

If there are multiple hidden packages that contain the module, we probably don't want all this blurb for each one; but some simple rewording should do, and all the info is available in Finder.cantFindError.

Better wordings welcome.


comment:2 Changed 7 years ago by igloo

Or perhaps Cabal should pass GHC a -cabal flag, and we could give a different error when that flag is given. Might be useful in other cases too.

comment:3 Changed 6 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

Now fixed:

$ ./Setup build
Preprocessing library pretty-
Building pretty-

    Could not find module `System.Directory':
      It is a member of the hidden package `directory-'.
      Perhaps you need to add `directory' to the build-depends in your .cabal file.
      Use -v to see a list of the files searched for.

You only get this extra cabal hint if -fbuilding-cabal-package is passed, and Cabal HEAD now passes this to GHC.

comment:4 Changed 6 years ago by simonmar

  • difficulty changed from Easy (1 hr) to Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.