kowainik / stan

🕵️ Haskell STatic ANalyser
https://kowainik.github.io/projects/stan
Mozilla Public License 2.0
565 stars 48 forks source link

[GHC 8.10] Cannot install: Could not find module Distribution.Extra.Doctest #365

Closed ulidtko closed 3 years ago

ulidtko commented 4 years ago

Hi!

I've tried installing Stan — but on my system, it does not want to :(

The build error is like this:

ulidtko@pasocon ~> cabal install -j1 stan
Resolving dependencies...
Build profile: -w ghc-8.10.1 -O1
In order, the following will be built (use -v for more details):
 - pretty-simple-3.2.3.0 (lib:pretty-simple) (requires build)
 - trial-optparse-applicative-0.0.0.0 (lib) (requires build)
 - trial-tomland-0.0.0.0 (lib) (requires build)
 - stan-0.0.1.0 (lib) (requires build)
 - stan-0.0.1.0 (exe:stan) (requires build)
[1 of 1] Compiling Main             ( /tmp/cabal-install.-1199716/dist-newstyle/tmp/src-1199716/pretty-simple-3.2.3.0/dist/setup/setup.hs, /tmp/cabal-install.-1199716/dist-newstyle/tmp/src-1199716/pretty-simple-3.2.3.0/dist/setup/Main.o )

/tmp/cabal-install.-1199716/dist-newstyle/tmp/src-1199716/pretty-simple-3.2.3.0/dist/setup/setup.hs:11:1: error:
    Could not find module ‘Distribution.Extra.Doctest’
    There are files missing in the ‘cabal-doctest-1.0.8’ package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
11 | import Distribution.Extra.Doctest ( defaultMainWithDoctests )
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build pretty-simple-3.2.3.0 (which is required by exe:stan
from stan-0.0.1.0). The failure occurred during the configure step.

ulidtko@pasocon ~ [1]> ghci
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
macro 'doc' overwrites builtin command.  Use ':def!' to overwrite.
Loaded GHCi configuration from /home/ulidtko/.config/dotfiles/HOME/ghci
λ
λλ ➔ import Distribution.Extra.Doctest
λ
λλ ➔ :t defaultMainWithDoctests 
defaultMainWithDoctests :: String -> IO ()
λ
λλ ➔ 

This is happening both with cabal install stan, cabal v2-install stan, and also with cabal v2-build exe:stan from git master.

I do build with global ghc-options: -dynamic. The cabal-doctest package is installed correctly, despite what the error message claims — which I demonstrate by importing it from ghci (which works fine).

System: Arch Linux. GHC 8.10.1. Cabal 3.2.0.0.

chshersh commented 4 years ago

@ulidtko Thanks for reporting the problem! I'm afraid, the root of the problem is not ideal Haskell support on Arch Linux. But I'm not using Arch Linux personally, so I can't provide a solution for this problem.

The following blog post describes some details and gives some solutions on how you can solve your issue:

I summon @fosskers and @dixonary who are more experienced Arch users. Maybe they can advise you on this :slightly_smiling_face:

dixonary commented 4 years ago

Interesting! I'm afraid that I can't really help debug this precise error, as my primary advice is to bypass the dynamic-by-default approach of Arch, and grab cabal-static from the AUR and ghc-static from Community instead.

fosskers commented 4 years ago

You rang?

Yes, Haskell on Arch isn't so good if you're mixing cabal usage with native packages from pacman. It's one of the reasons I do all my Haskelling with stack, and that's what I recommend here too. stan does have a stack.yaml, so getting it working is just a stack install away. That's how I personally got stan running just fine on my own machine the day it was announced.

To install stack on Arch I recommend stack-static.