Skip to content

“Failed to get project GHC version:CradleError” cabal haskell project is not working fine with haskell-language-server-wrapper #1527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rajcspsg opened this issue Mar 9, 2021 · 3 comments
Labels
build tool: cabal status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@rajcspsg
Copy link

rajcspsg commented Mar 9, 2021

I've created a cabal project

   mkdir cabal_project && cd cabal_project
   
   cabal  init 

When I opened the cabal_project in emacs, the lsp server for haskell is starting and it errors out. When I open non cabal project and haskell file in it it, then it is working fine.

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server-wrapper --probe-tools                                     00:58:15
haskell-language-server version: 1.0.0.0 (GHC: 8.10.4) (PATH: /home/rajkumar/.ghcup/bin/haskell-language-server-wrapper-1.0.0) (GIT hash: 4cd1cf934638881e52b3eba9f70157a4b799c0e9)
Tool versions found on the $PATH
cabal:          3.4.0.0
stack:          Not found
ghc:            8.10.4

Which lsp-client do you use:
emacs

Steps to reproduce

mkdir cabal_project && cd cabal_project

cabal  init

open cabal_project in emacs.

Expected behaviour

If I open cabal_project/app/Main.hs I shouldn't get any error. lsp should work fine.

Actual behaviour

lsp server crashes with error log Failed to get project GHC version:CradleError

Include debug information

See the lsp logs for emacs in gist file here https://gist.github.com/rajcspsg/81bd373d35dba5cf355264d17e275bb8

I've asked this question in SE as well. https://emacs.stackexchange.com/questions/63799/failed-to-get-project-ghc-versioncradleerror-cabal-haskell-project-is-not-wor

@Ailrun
Copy link
Member

Ailrun commented Mar 9, 2021

Does cabal build work? I guess it won't, as the log says your .cabal file wants base ^>= 4.15 while you are using GHC 8.10

@Ailrun Ailrun added build tool: cabal status: needs info Not actionable, because there's missing information labels Mar 9, 2021
@jneira jneira added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. type: setup build tool: cabal status: needs info Not actionable, because there's missing information and removed build tool: cabal status: needs info Not actionable, because there's missing information labels Mar 9, 2021
@tmciver
Copy link

tmciver commented Jun 30, 2021

I ran into this error when trying to get haskell-language-server running under Nix by following this article. cabal build did not work. It errored with "Could not resolve dependencies" when trying to resolve the base dependency. The cabal file declared the base dependency with ^>=4.13.0.0 but I'm using GHC 8.10.4 which has base 4.14.1.0. I believe ^>=4.13.0.0 desugars to >=4.13 && <=4.14, causing the miss.

I was able to fix this by removing the caret operator on the version bound for base (changed ^>= to >=). I'm not sure what's causing this but it may be a problem with the versions of GHC and cabal-install used in the version of nixpkgs I'm using.

@jneira
Copy link
Member

jneira commented Jan 31, 2022

hls-wrapper needs a buildable project with cabal or throws an error only shown in logs
fortunately @fendor is working on make it a editor popup error with the build error (the same you will hit if you run cabal build in a shell)
so closing this

@jneira jneira closed this as completed Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: cabal status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

4 participants