DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
677 stars 175 forks source link

Failing to build ghc-mod with stack #940

Open venantius opened 6 years ago

venantius commented 6 years ago

Forgive me if this issue turns out to be totally asanine; I'm new to this.

I created a new stack project, set the resolver to ghc 8.0.2, and tried to stack build ghc-mod. No luck - it failed to find a bunch of dependencies, and recommended I add them to extra-deps. I did so, tried again, and it told me to add more. And more. And more.

So then I end up with this:

stack.yaml

flags: {}
packages:
- .
extra-deps:
- cabal-helper-0.7.3.0
- djinn-ghc-0.0.2.3
- extra-1.5.3
- fclabels-2.0.3.3
- ghc-paths-0.1.0.9
- ghc-syb-utils-0.2.3.3
- hlint-2.0.15
- base-4.7.0.2
- StateVar-1.1.1.1
- deepseq-1.3.0.2
- vector-algorithms-0.7.0.4
- monad-control-1.0.2.3
- monad-journal-0.7.2
- mtl-2.2.2
- old-time-1.1.0.3
- optparse-applicative-0.13.2.0
- pipes-4.3.9
- safe-0.3.17
- semigroups-0.18.5
- split-0.2.3.3
- syb-0.7
- temporary-1.2.1.1
- text-1.2.3.0
- transformers-base-0.4.5.2
- aeson-1.4.0.0
- ansi-terminal-0.8.0.4
- ansi-wl-pprint-0.6.8.2
- async-2.2.1
- base-orphans-0.8
- clock-0.7.2
- cmdargs-0.10.20
- cpphs-1.20.8
- data-default-0.7.1.1
- djinn-lib-0.0.1.3
- either-4.4.1.1
- exceptions-0.10.0
- haskell-src-exts-util-0.2.3
- hscolour-1.24.4
- mmorph-1.1.2
- old-locale-1.0.0.7
- refact-0.3.0.2
- stm-2.4.5.0
- transformers-compat-0.6.2
- uniplate-1.6.12
- unordered-containers-0.2.9.0
- utf8-string-1.0.1.1
- vector-0.12.0.1
- void-0.7.2
- yaml-0.10.0
- cabal-doctest-1.0.6
- comonad-5.0.4
- contravariant-1.5
- distributive-0.6
- haskell-src-exts-1.20.2
- integer-logarithms-1.0.2.1
- mono-traversable-1.0.9.0
- prelude-extras-0.4.0.3
- random-1.1
- time-1.4.2
- unliftio-core-0.1.1.0
- MonadRandom-0.5.1.1
- attoparsec-0.13.2.2
- base-compat-0.10.4
- bifunctors-5.5.3
- colour-2.3.4
- conduit-1.3.0.3
- data-default-class-0.1.2.0
- data-default-instances-containers-0.0.1
- data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1
- dlist-0.8.0.4
- free-4.12.4
- hashable-1.2.7.0
- polyparse-1.12
- primitive-0.6.4.0
- profunctors-5.3
- resourcet-1.2.1
- scientific-0.3.6.2
- semigroupoids-5.3.1
- tagged-0.8.6
- th-abstraction-0.2.8.0
- time-locale-compat-0.1.1.4
- uuid-types-1.0.3
resolver: ghc-8.0.2

I tried again and at this point there was a conflict around which version of base it wanted, and told me to try setting allow-newer: true. I did, and this allowed about half the project to build before failing.

I feel like I have to be missing something obvious here - what am I doing wrong?

DanielG commented 6 years ago

At the moment time is a bit of a scarse resources around ghc-mod, it seems to have fallen out of stackage since lts-6 (i.e. GHC 7.10). Personally I don't use Stack and thus don't pay it much mind unless someone complains and sends patches :)

In principle ghc-mod should build with GHC 8.0.2 though so this is likely just a bounds issue. Maybe have a look at the Stackage Curator documentation if you want to help fixing this.

I'd be happy to execute any required metadata revisions on Hackage if you can figure out what needs fixing.

venantius commented 6 years ago

In the end I followed the advice in one of the other GitHub issues about GHC support and downgraded my resolver to lts-9.2.1 and that seems to have done the trick. It doesn't work with any more recent lts resolvers.

akurilin commented 5 years ago

Just to confirm, looks like ghc-mod is not buildable with stack in the last few LTS releases. I'd suggest removing mentions of stack for the time being, e.g. https://github.com/DanielG/ghc-mod/wiki/Installing#using-the-stack-tool can be confusing unless you know of this issue.

xaviershay commented 5 years ago

I tried to understand the stackage curator thing but didn't get very far ... was confused that the only mention of ghc-mod in the stackage repo is in a config option to disable tests (#611), and unclear how I would verify "what is needed" to get it going.

Instead switched my .stack/global-project/stack.yaml to:

packages: []
resolver: "lts-9.21"

And now stack install ghc-mod works.

xaviershay commented 5 years ago

DISCLAIMER: I am totally science-dogging this.

Aha I think I understand right now: we can't "add a temporary upper bound" in stackage for these packages, because they are super common packages (like base), and this upper bound has to apply for everything in stackage. So what I believe needs to happen is a new version of ghc-mod needs to be released that relaxes the upper bounds from the initial error message (this here from lts-11.22):

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25  (latest matching version is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10  (latest matching version is 4.9.1.0)
    cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version  (latest matching version is 0.7.3.0)
    extra-1.6.9 from stack configuration does not match <1.6 && >=1.4  (latest matching version is 1.5.3)
    ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
    haskell-src-exts-1.20.2 from stack configuration does not match <1.20 && >=1.18  (latest matching version is 1.19.1)
    hlint-2.1.10 from stack configuration does not match <2.1 && >=2.0.8  (latest matching version is 2.0.15)
    monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4  (latest matching version is 0.7.2)
    optparse-applicative-0.14.2.0 from stack configuration does not match >=0.13.0.0 && <0.14  (latest matching version is 0.13.2.0)

Those constraints are from ghc-mod-5.8.0.0 and some have already been addressed on master. From my reading of the current ghc-mod.cabal, this implies the following constraints need to be amended:

Further, cabal-helper is not in stackage anymore? It may need to be added?

xaviershay commented 5 years ago

Ok there is definitely existing WIP that I believe would address this: https://github.com/DanielG/ghc-mod/pull/933 It currently seems stalled on the cabal-helper dep. There is discussion of that (maybe relevant?) in https://github.com/DanielG/ghc-mod/issues/900

ianchanning commented 5 years ago

I'm running:

I get the following error:

[ian@localhost ~]$ stack install ghc-mod
Writing implicit global project config file to: /home/ian/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-12.22
Downloaded lts-12.22 build plan.    
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-tinfo6-8.4.4.                                      
Unpacking GHC into /home/ian/.stack/programs/x86_64-linux/ghc-tinfo6-8.4.4.temp/                                                                                Installed GHC.     
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Downloading root 
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Downloading timestamp
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Downloading snapshot
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Downloading mirrors
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Cannot update index (no local copy)
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Downloading index
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Updated package index downloaded
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                Update complete  
Populated index cache.    

Error: While constructing the build plan, the following exceptions were
encountered:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.2.0.1 from stack configuration does not match >=1.18 && <1.25 
                  (latest matching version is 1.24.2.0)
    base-4.11.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 
                  (latest matching version is 4.9.1.0)
    cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has
                 no specified version  (latest matching version is 0.7.3.0)
    djinn-ghc must match <0.1 && >=0.0.2.2, but the stack configuration has no
              specified version  (latest matching version is 0.0.2.3)
    extra-1.6.13 from stack configuration does not match <1.6 && >=1.4  (latest
                 matching version is 1.5.3)
    ghc-8.4.4 from stack configuration does not match >=7.6 && <8.2 
    ghc-syb-utils must match <0.3 && >=0.2.3, but the stack configuration has no
                  specified version  (latest matching version is 0.2.3.3)
    haskell-src-exts-1.20.3 from stack configuration does not
                            match <1.20 && >=1.18  (latest matching version
                            is 1.19.1)
    hlint-2.1.11 from stack configuration does not match <2.1 && >=2.0.8 
                 (latest matching version is 2.0.15)
    monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 
                        (latest matching version is 0.7.2)
    optparse-applicative-0.14.3.0 from stack configuration does not
                                  match >=0.13.0.0 && <0.14  (latest matching
                                  version is 0.13.2.0)
    temporary-1.3 from stack configuration does not match <1.3 && >=1.2.0.3 
                  (latest matching version is 1.2.1.1)
needed since ghc-mod is a build target.

Some different approaches to resolving this:

  * Consider trying 'stack solver', which uses the cabal-install solver to
    attempt to find some working build configuration. This can be convenient
    when dealing with many complicated constraint errors, but results may be
    unpredictable.

  * Build requires unattainable version of base. Since base is a part of GHC,
    you most likely need to use a different GHC version with the matching base.

Plan construction failed.