`cabal: Could not resolve dependencies` with the result of `cabal init`.
kindaro opened this issue · 2 comments
See for yourself:
- Create a new directory.
- Enter it.
- Run
cabal init
. A new Haskell project with one Haskell source fileapp/Main.hs
should appear. - Run
emacs
onapp/Main.hs
. - Observe crash:
Server lsp-haskell … exited with exit status exit(check corresponding stderr buffer for details). Do you want to restart it? (y on n)
.
I also observe a similar effect with other projects. But there are projects where the thing flies — for example, tasty
. I have no idea what the difference is.
This is the contents of lsp-haskell::stderr
buffer.
Module "/tmp/x/app/a" is loaded by Cradle: Cradle {cradleRootDir = "/tmp/x", cradleOptsProg = CradleAction: Cabal}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.0.0.0 x86_64 ghc-8.10.4
Current directory: /tmp/x/app
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /tmp/x
Cradle type: Cabal
Tool versions found on the $PATH
cabal: 3.5.0.0
stack: 2.3.3
ghc: 8.6.5
Consulting the cradle to get project GHC version...
Failed to get project GHC version:CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Error when calling cabal --builddir=/home/kindaro/.cache/hie-bios/dist-x-15f593d9752f4b42dad4d140ce72bef9 v2-exec --with-compiler /home/kindaro/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --numeric-version","","cabal: Could not resolve dependencies:\n[__0] trying: x-0.1.0.0 (user goal)\n[__1] next goal: base (dependency of x)\n[__1] rejecting: base-4.12.0.0/installed-4.12.0.0 (conflict: x =>\nbase^>=4.14.1.0)\n[__1] rejecting: base-4.14.1.0, base-4.14.0.0, base-4.13.0.0, base-4.12.0.0,\nbase-4.11.1.0, base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0,\nbase-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2,\nbase-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0,\nbase-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0,\nbase-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0,\nbase-3.0.3.2, base-3.0.3.1 (constraint from non-upgradeable package requires\ninstalled instance)\n[__1] fail (backjumping, conflict set: base, x)\nAfter searching the rest of the dependency tree exhaustively, these were the\ngoals I've had most trouble fulfilling: base, x\n\n"]}
Process lsp-haskell stderr finished
By the way, I have no idea why it detects ghc
to be 8.6.5. I have a variety of GHC versions installed, but the default, by the name ghc
, is 8.10.4. The command cabal --builddir=/home/kindaro/.cache/hie-bios/dist-x-15f593d9752f4b42dad4d140ce72bef9 v2-exec --with-compiler /home/kindaro/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --numeric-version
, mentioned in the buffer quoted above, tells this correct version number. If it first configures for GHC 8.10.4 and then tries to run with GHC 8.6.5, then this might be the reason why it cannot take off.
I have tried to tell it what the correct GHC is by supplying an entry cradle/bios/with-ghc
to hie.yaml
, but it makes no difference.
I am not an Emacs hacker, I have no idea what lsp-haskell
version is being used and where to look it up. I use Spacemacs and pray. I also do not know if this is the right place to ask for help, but every command line tool in isolation works alright — hie-bios
, haskell-language-server
, ghc
, cabal
— all of them talk to me and seem healthy. I also use lsp
with C and it works fine.
This is a haskell-language-server
issue: we've launched it correctly, but then it's not working properly. So I think you need to ask over there!
Thanks!