14

I have never had this before but today I tried to use ghc and get:

could not find module
there are files missing in the base-4.10.0.0 package

ghc-pkg check returns:

https://pastebin.com/aCmr9igi

user7637341
  • 421
  • 1
  • 6
  • 15
  • Please include the exact command you ran, any relevant source files, and the *exact* error you got. It was good to include the output of ghc-pkg check. You can safely ignore the warnings about haddock; I didn't see any other lines when I scrolled through quickly, but could you use grep or similar to verify that all of ghc-pkg check's output is about missing haddocks? Also, site rules say you should include all information relevant to the question here on StackOverflow itself (rather than using pastebins). – Daniel Wagner Sep 22 '17 at 15:18
  • 1
    That said, given the current information, I assign high probability to the simplest solution being "reinstall GHC". – Daniel Wagner Sep 22 '17 at 15:19
  • @DanielWagner Tried reinstalling GHC, didn't fix. I get this error for any module used. Sorry for using pastebin, i thought it would be easier for formatting than pasting it all in here because its quite big. – user7637341 Sep 22 '17 at 15:24
  • What system you are using, which ghc version, do you use stack or cabal? – epsilonhalbe Sep 22 '17 at 16:21
  • 2
    Arch Linux - ghc version 8.2.1, dont use stack or cabal. – user7637341 Sep 24 '17 at 12:16
  • 2
    Exact same issue here - also on Arch with 8.2.1 – user569825 Sep 26 '17 at 13:23

3 Answers3

13

I had the exact same issue. Installing ghc-static fixed it.

qfwfq
  • 2,416
  • 1
  • 17
  • 30
11

You probably need to tell ghc to use shared libraries via the -dynamic flag, e.g.

$ ghc --make -dynamic path/to/file.hs

Doing this means you do not need to install the ghc-static package.

Philippe Fanaro
  • 6,148
  • 6
  • 38
  • 76
pyrospade
  • 7,870
  • 4
  • 36
  • 52
  • 3
    @meyer1994 If you're on Arch, you can do `pacman -Ql ghc` and you'll see that all of the compiled files are .dyn_hi as opposed to .hi, which are loaded via -dynamic – pyrospade Nov 14 '17 at 06:00
  • Is there a particular reason for Arch to save them all as .dyn_hi? Why not just save as .hi? I imagine it is memory related(?). – meyer1994 Nov 14 '17 at 22:30
  • I'm nit entirely sure, but here's a somewhat related discussion on the topic - https://github.com/commercialhaskell/stack/issues/3409 – pyrospade Nov 15 '17 at 05:17
5

Try to tell ghc to build dynamically linked object files and executables, e.g., by

cabal install --dependencies-only --ghc-option=-dynamic
Dominik Schrempf
  • 827
  • 8
  • 14