1

I installed ghcup and:

  • Stack 2.9.1
  • HLS 1.8.0
  • cabal 3.6.2
  • GHC 9.2.5

All of them are the recommended versions(I verified it using ghcup tui). Then I installed the Haskell extension in VSCode. Unfortunately, it doesn't work. I get syntax highlighting (from the Haskell Syntax Highlighting extension, which seems to be automatically installed alongside the Haskell extension) but there is no Intellisense, no code completion, no error detection and no interactive mode (-->>> evaluation). I experimented with different folders and haskell files. The filetype is correct, because every time I open a .hs file, the Haskell extension checks for updates. I even installed Codium, because I suspected a fault in VSCode, but it was the same there as well.

The hsl language server doesn't seem to be working in Neovim, either. I uninstalled ghcup (ghcup nuke) and reinstalled again. The result is exactly the same. I prepended the PATH and chose vanilla and non-vanilla Stack integration in either installations.

Am I doing something wrong?

OS: Linux Mint on Ubuntu 20.04.1, kernel 5.15.0-56.

rioV8
  • 24,506
  • 3
  • 32
  • 49
Kotaka Danski
  • 451
  • 1
  • 4
  • 14
  • I also tried `GHC 9.0.2` and that didn't work either. – Kotaka Danski Dec 11 '22 at 07:50
  • Reverting to previous versions of the `Haskell` extension didn't work either. At this point, I think it's the Haskell Language Server, which is causing the problem. – Kotaka Danski Dec 11 '22 at 08:07
  • I just installed HSL version 1.7.0.0 and it didn't fix my problem. Now, however, when I try to go back to version 1.8.0.0, even though `ghcup tui` says it's installed, when I set it, I get a prompt "This Version of HLS you are trying to set is not installed. Would you like to install it first? [Y/N]:" If I pick "Yes", the prompt repeats itself endlessly. If I pick "No", I get an error message: "Version 1.8.0.0 is not installed". `ghcup tui` says both 1.7.0.0 and 1.8.0.0 are available and indeed I have kept both of them. In reality, neither seems available. – Kotaka Danski Dec 11 '22 at 08:42
  • 1
    Me too and I abandoned. Each time I solved an issue there was a new one. It's a pity because this extension is really cool. – Stéphane Laurent Dec 11 '22 at 21:15
  • @StéphaneLaurent I just solved it yesteday. I will post a solution. – Kotaka Danski Dec 12 '22 at 06:30

1 Answers1

2

After around 10 tries, I managed to fix the problem. It turned out I had three problems:

  • I had only 12 GB free on my Linux partition, but it seems more are needed. I realised it, when it turned out some haskell-language-server files were missing. I enlarged my Linux partition (something I should have done months ago). The new installation installed all files
  • The Haskell Language Server HLS was not added to the PATH. I solved it by putting this snippet in ~/.ghcup/config.yaml:
  "haskell.serverEnvironment": {
    "PATH": "${HOME}/.ghcup/bin:$PATH"
  }
  • The server was now discovered by the Haskell VS Code extension but crashed 5 times and gave up on trying. Restarting it manually didn't help. I opened the logs: View->Output->Haskell and saw the error:
haskell-language-server-wrapper: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by haskell-language-server-wrapper)

It turns out, my Linux Mint distribution uses GLIBC_2.31, not 2.32. This is a very important library, which most applications on the system use. If you are a newbie, it is strongly advised that you DO NOT update it manually.

  • Instead, what I did, was install a version of the HLS, which used GLIBC_2.31. This problem occured in September and was "fixed" but apparently not very well. There are two options:
    • download the HLS deb10 version manually (didn't work for me):
    ghcup install hls -u https://downloads.haskell.org/~hls/haskell-language-server-1.8.0.0/h
    
    • download using ghcup tui HLS version 1.7.0.0 (or whatever newest, which uses your glibc version) and a GHC, which supports that particular version of the HLS (in my case 9.0.2).
  • I think it's a good idea to preemptively reinstall the extension, in case it used the PATH to configure the HLS, so that its settings are restored to default. It takes up to 20 seconds to initialize the server, so be patient. You can see what's happening in the Output window and verify there are no more errors.

I hope this helps.

Kotaka Danski
  • 451
  • 1
  • 4
  • 14
  • 1
    Thanks. This has solved some issues for me, but there's a remaining one: *The Haskell server crashed 5 times in the last 3 minutes and won't be restarted*. No way to restart it. – Stéphane Laurent Dec 12 '22 at 10:28
  • This sounds exactly like my third error. Did you install `Haskell Language Server 1.7.0.0` and `GHC 9.0.2`? More importantly, did you set them (installation doesn't set them automatically)? Could you please open the `Output` tab of the terminal and select the `Haskell` view to see what is the reason the server fails. – Kotaka Danski Dec 12 '22 at 13:03
  • By default, `ghcup` uses versions `HLS 1.8.0.0` and `GHC 9.2.5`, not `1.7.0.0` and `9.0.2`, so you have to install them and set them as default using `ghcup tui`. Please `run ldd --version` in the terminal, so we can be sure what `GLIBC` version you have. – Kotaka Danski Dec 12 '22 at 13:11
  • 1
    It works!! I had to add the path to `gcc`. The error was `ghc cannot find gcc`. Thanks!!! – Stéphane Laurent Dec 12 '22 at 15:22
  • Oh, yes. During installation it asks you to verify you have a bunch of packages. I am glad everything has worked out for you! Please upvote the question, if you find it useful. I often get a lot of hate on SO and my reputation is very low, so I need every single point I can get :-D. – Kotaka Danski Dec 12 '22 at 17:38
  • 1
    I already upvoted! – Stéphane Laurent Dec 12 '22 at 17:51
  • 1
    I just fixed the bindists for HLS, this should be fixed: https://github.com/haskell/ghcup-metadata/commit/1ba37946e15fdcf7d09de01382e44e1849c87bb2 – hasufell Dec 13 '22 at 11:43