haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

GHC ABIs don't match! GHC 9.2.4 from ghcup #3225

Open MaybeJustJames opened 2 years ago

MaybeJustJames commented 2 years ago

Your environment

Tool versions found on the $PATH
cabal:          3.8.1.0
stack:          2.7.5
ghc:            9.2.4
$ haskell-language-server-wrapper --version
haskell-language-server version: 1.8.0.0 (GHC: 9.4.2) (PATH: $HOME/.ghcup/hls/1.8.0.0/lib/haskell-language-server-1.8.0.0/bin/haskell-language-server-wrapper)

Which OS do you use? Debian Testing Which version of GHC do you use and how did you install it? 9.2.4 with ghcup (reinstalled) How is your project built (alternative: link to the project)? Cabal (https://github.com/MaybeJustJames/zephyr)

Which LSP client (editor/plugin) do you use? Emacs+lsp-mode Which version of HLS do you use and how did you install it? 1.8.0.0 from ghcup Have you configured HLS in any way (especially: a hie.yaml file)? No

Steps to reproduce

run haskell-language-server-wrapper -d --lsp

Expected behaviour

Should start lsp server and not produce errors

Actual behaviour

Says GHC ABIs don't match! and quits.

Debug information

Full output from running haskell-language-server-wrapper -d --lsp:

$ haskell-language-server-wrapper -d --lsp
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.8.0.0 x86_64 ghc-9.4.2
Current directory: /home/jacol/vib/zephyr
Operating system: linux
Arguments: ["-d","--lsp"]
Cradle directory: /home/jacol/vib/zephyr
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.8.1.0
stack:          2.7.5
ghc:            9.2.4

Consulting the cradle to get project GHC version...
Project GHC version: 9.2.4
haskell-language-server exe candidates: ["haskell-language-server-9.2.4","haskell-language-server"]
Launching haskell-language-server exe at:/home/jacol/.ghcup/bin/haskell-language-server-9.2.4
GHC ABIs don't match!

Expected: Cabal-3.6.3.0:c308d49c110bceb69e8e2f026331ca5b array-0.5.4.0:5c7e3cf391f521f79c55fb6ff2b1350c base-4.16.3.0:1eb0bb120818988a446a5fea8451018b binary-0.8.9.0:5201d47172bfee2614c1e352486df9f3 bytestring-0.11.3.1:409a435a1de660c377f73be9d912cafd containers-0.6.5.1:b78dd9f1b73a36f696c42ef4f079347b deepseq-1.4.6.1:95a2cce30d9104099ef3912bbfa65758 directory-1.3.6.2:dbde089474b7a6d02dd904ca48eeb25f exceptions-0.10.4:316098aa76df7c33f61db8cb5e3b938d filepath-1.4.2.2:e04ad72732f21f5d033a086568e03d30 ghc-9.2.4:3f636307ba9b50a2c3a95e1eae766a1c ghc-bignum-1.2:ef49d0850fdcb44e28e4cea00dd9aed4 ghc-boot-9.2.4:d17d07e02dfb3de9d3589b16b8b138e6 ghc-boot-th-9.2.4:b421d2962a747b2c5464d9380bfa26f1 ghc-compact-0.1.0.0:cfd3b877e6124b6e3f38981e5965e586 ghc-heap-9.2.4:5d0bf9d35a93e411048f05e30a0670fa ghc-prim-0.8.0:bc6173fa25876dd81d5658ded8ad141c ghci-9.2.4:94d8bb98aff329762bf097492864f82d haskeline-0.8.2:77bc5018ba063871af1b82402bc1abeb hpc-0.6.1.0:9cebe4c611ae618d5241abe7a4c3aa2e integer-gmp-1.1:7814bbd28e3dfa619fcd4ae63db9f463 libiserv-9.2.4:344bf048343d484455d0014af9e71876 mtl-2.2.2:2fd140cd47cf231d7d31e6a89befe79a parsec-3.1.15.0:76e539e5ff8c82cc0faa02398bc45aef pretty-1.1.3.6:0fcfbbd1abae74a19e3dbea3cbf8d80a process-1.6.13.2:f9a3f2205eb75f6ed778aaa1e70cb35d rts-1.0.2: stm-2.5.0.2:556ee489fa118ea025a84e9bc2cc27c9 template-haskell-2.18.0.0:b3fc16457a19b4935414ca1ca4a90fea terminfo-0.4.1.5:4c20cc3ffdc530bffacb68a054a7d8ec text-1.2.5.0:e39407ad0600cd68c700616f118fac7e time-1.11.1.1:65ddd6a4f72b5de5ec10eb07adbf44a1 transformers-0.5.6.2:7ca08989cf903cb55f1ba49351542872 unix-2.7.2.2:5b2b120dc99cc2884283703c2eac56f7 xhtml-3000.2.2.1:9396807cc3932339e64626618674f418
Got:      Cabal-3.6.3.0:77abbc1694ffae055505d8d5d1147c6d array-0.5.4.0:3226806241243afbacbe6f2092d8a7cf base-4.16.3.0:e35a3e69ccf4829dc3e77990f9dc45ba binary-0.8.9.0:1a05332d395614da536a2301ce89b7c5 bytestring-0.11.3.1:e9e844a5702502325dd4603b8d6abf36 containers-0.6.5.1:73ee1afcb70d68fe0aeeb05997adc2d7 deepseq-1.4.6.1:1badd01e7f3be7f84acaab82f90a1827 directory-1.3.6.2:43a14c51104f436ebc51c4c447066d82 exceptions-0.10.4:7c4b80bfde0a5b30176104e12db135d2 filepath-1.4.2.2:f8be76941408f8839ceb66ed69881ea8 ghc-9.2.4:eb3dd04a24433e5f1cc5399d51cf31e7 ghc-bignum-1.2:4b1dbde2ab68531401454757e351de12 ghc-boot-9.2.4:06b4aa485076352ee46d1031f6a83546 ghc-boot-th-9.2.4:d58bc459c3a3422cd207d20828d2741d ghc-compact-0.1.0.0:1d13db9804a23c1277d62d5a37d76447 ghc-heap-9.2.4:2458793bc8218470467349f37590389b ghc-prim-0.8.0:d94b867d423d45632f372f5ef02da868 ghci-9.2.4:69f803cc4c27a69b63e2e5e120806dfe haskeline-0.8.2:4a6364025df791364a6abe44a387c946 hpc-0.6.1.0:61edba54d249dbf1c6d6f26f59cafae7 integer-gmp-1.1:b93bebfc17c0ecdc392d896a0373d3b0 libiserv-9.2.4:bab7741e9274af88f3ef1c88a5e5da24 mtl-2.2.2:24ac9418bead900061be1c068549bf13 parsec-3.1.15.0:8623c8f4c68417c99aede99a8048cead pretty-1.1.3.6:bc6d6c7747814b2ca683a22ca2473663 process-1.6.13.2:04c0b7c918ef87cdb4a4b3d9fa04bb09 rts-1.0.2: stm-2.5.0.2:08eb1833b27f0691a5a967104d3491cd template-haskell-2.18.0.0:562dccca3a9a4656b3d4af3b50ce021a terminfo-0.4.1.5:00c0ee4013b298a5620627e14debb912 text-1.2.5.0:0bd60486f1482aed876337a707276e7d time-1.11.1.1:01d5542d865e00e96fd75ae61200475b transformers-0.5.6.2:ab19802e548f17da77c6cff664cfc1ba unix-2.7.2.2:d81b7897adbf7d12dcd457ad5fee049a xhtml-3000.2.2.1:8c3259619a9f17338b256411daa8c434
Content-Length: 203

{"jsonrpc":"2.0", "method":"window/showMessage", "params": {"type": 1, "message": "Couldn't find a working/matching GHC installation. Consider installing ghc-9.2.4 via ghcup or build HLS from source."}}
Vlix commented 2 years ago

Can confirm, I got this too just today trying to make a PR for the stack code base. (which uses nightly-2022-09-05 => 9.2.4)

NSchweers commented 2 years ago

I have the same problem, also using ghcup. I’m not using stack btw.

chris-martin commented 2 years ago

Same problem, with a cabal cradle, on NixOS.

Found "/home/chris/step/hie.yaml" for "/home/chris/step/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.8.0.0 x86_64 ghc-9.0.2
Current directory: /home/chris/step
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/chris/step
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.6.2.0
stack:          2.9.1
ghc:            8.10.7

Consulting the cradle to get project GHC version...
Project GHC version: 9.2.4
haskell-language-server exe candidates: ["haskell-language-server-9.2.4","haskell-language-server"]
Launching haskell-language-server exe at:/run/current-system/sw/bin/haskell-language-server-9.2.4
GHC ABIs don't match!

Expected: Cabal-3.6.3.0:4b7e5ec6bdf830a1a1b2a7dac58977f1 array-0.5.4.0:5b6490cad7f3f7572d546f8b609ab5e0 base-4.16.3.0:c5bc28c025beb0264fc8226e2c52585f binary-0.8.9.0:3467ec1ec9ebdf27d237041af2c1959c bytestring-0.11.3.1:c44471ca3ccd3f2648b7587883fa5a0c containers-0.6.5.1:dd9dffa29f32147b58e55bebae95b5db deepseq-1.4.6.1:b451808304261aa84576eec130791cfe directory-1.3.6.2:64781d8f03e3f773fe526d1b54e2f760 exceptions-0.10.4:27cbbb7404c2c0ba34b485760477a927 filepath-1.4.2.2:2ac1b495ac13ab732f61bdb6780f2373 ghc-9.2.4:eb044f2cd8245d00c6eb6ad0a7923734 ghc-bignum-1.2:dc85b95457973c61442221e0ffe629c6 ghc-boot-9.2.4:06c770350c8bb262c731d1ce5dc9465a ghc-boot-th-9.2.4:6e0652962643991014f7550becbbea0c ghc-compact-0.1.0.0:ee6e4afa050602a96a19159e340a5996 ghc-heap-9.2.4:9725793cbb0cb2cc322950ab7808b251 ghc-prim-0.8.0:4cc52b9ce520bef4b4b307f9c09dccc6 ghci-9.2.4:b3b17d1fe993276916c81079ee2af42d haskeline-0.8.2:169a7a5f58148d73b67a7d679caed78e hpc-0.6.1.0:dcb83814f92eaaa32e15e3662311653c integer-gmp-1.1:c1089126cca779e75e5d6be31dc98f1c libiserv-9.2.4:9dfbf9cddc1feda79c3cade1fea0a031 mtl-2.2.2:01acc56352d8d4a1aacf42ca6cafe798 parsec-3.1.15.0:f150c96d70dc28aaac57fa9309c6da55 pretty-1.1.3.6:4a9ca6916f9a09ea73c9f2d557de6dbe process-1.6.13.2:e8831e28f979c604cf2bdcc6343b82de rts-1.0.2: stm-2.5.0.2:698e4c9e1c98b38e7878ef6daed8fee0 template-haskell-2.18.0.0:784eaffa1a127ca0e0a038396ee6bade terminfo-0.4.1.5:f6ed3a81f33918a3be9cae13f6432b2b text-1.2.5.0:99994021d619a60e5b6415397ec203a0 time-1.11.1.1:2cce28be435d6102e981e97b8bf006dd transformers-0.5.6.2:0a1edf560a7bed14ad74083da63d8d51 unix-2.7.2.2:69bb008b1f37818f6f0cc676e496c776 xhtml-3000.2.2.1:18578e0711e6ce7eef4315f9539499f6
Got:      Cabal-3.6.3.0:25fba52c40181697fb3e713992ed45ba array-0.5.4.0:76cdd7bd1dcdc69c94bfdba15e8c6113 base-4.16.3.0:492259c9903ba198330543adb282f19e binary-0.8.9.0:19180f1597293723d6217c1b90b9a79b bytestring-0.11.3.1:95d9031c73bb5ab340e841ae94b7477f containers-0.6.5.1:d846c7d4982e7805444e51e49c821b38 deepseq-1.4.6.1:f2c5dcf8a1579d80b359626ce3922368 directory-1.3.6.2:2afa15347f21158b34c50d342441fe98 exceptions-0.10.4:449bdd2288659954b3d3661c0bfc5745 filepath-1.4.2.2:95fde980ccf062e2759eef777034b682 ghc-9.2.4:13c6127884c444a4db15a246a1d47fa6 ghc-bignum-1.2:424a60c92296b6bf9df03965d6ca0a47 ghc-boot-9.2.4:2c7847162f55498bdbe5c0ae3db13e30 ghc-boot-th-9.2.4:7a2b977da6aa46d333b6004068bbd6de ghc-compact-0.1.0.0:7561df05aadf78830874635c3ae72299 ghc-heap-9.2.4:a0908b55f604995fe69c160e7cea9fbd ghc-prim-0.8.0:7d885d3805aedfad6c36b0db5139905b ghci-9.2.4:a2679b996406f73602a4f6a54dff72fe haskeline-0.8.2:f0f5a6dace1caf18586980c4fae1f1e3 hpc-0.6.1.0:7ec88158e73323dde697d3ffe253f181 integer-gmp-1.1:6ed2368cc3d74394a7368eab0a8d36ca libiserv-9.2.4:2c2a3c06b41591dc323751c4f23a23c4 mtl-2.2.2:3919aa3264c0098cfadf7f6124c2beaf parsec-3.1.15.0:4ad227130bc0093d3786b2c6151ad6d9 pretty-1.1.3.6:4ed3595c419cfa732ac8d2e07e54900b process-1.6.13.2:6a60847e6df048da601c195db18388c0 rts-1.0.2: stm-2.5.0.2:567704c182ae9013dd80e8deb613efd8 template-haskell-2.18.0.0:17721f9d3e29b3d3faacf9841e5aa17e terminfo-0.4.1.5:4c5a84b3cdc499c8ffebe0138b1d1f1d text-1.2.5.0:69be2eead0f1bf0c6e932902aa79e76e time-1.11.1.1:ce0e124f467cbdad7f214af38af802fd transformers-0.5.6.2:58eb294318dbfc55aee264a787e08aea unix-2.7.2.2:b571b306c66cdbbd63b493aa3e92594a xhtml-3000.2.2.1:3f258f622e39511ac05a7f8f6d399fd1
chris-martin commented 2 years ago

The problem in my case seems to have resulted from my Nix configuration: I was getting GHC from nixos-22.05 and haskell-language-server from nixos-unstable.

NSchweers commented 2 years ago

Building from source via ghcup compile ... solved the problem for me.

hallettj commented 2 years ago

I have the same problem. I'm also on Debian testing with these tool versions:

Tool versions found on the $PATH
cabal:          3.8.1.0
stack:          2.9.1
ghc:            9.2.4

Edit: I have been informed that I can build using source from git instead of from hackage using this variation of the compile command which does work for me:

$ ghcup compile hls -g 1.8.0.0 --ghc 9.2.4

I'm not able to compile hls myself due to this error which I have no idea how to resolve:

$ ghcup compile hls -v 1.8.0.0 --ghc 9.2.4
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/jesse/.ghcup/cache/ghc
up-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Warn  ] New ghc version available. To upgrade, run 'ghcup install ghc 9.4.2'
Downloading  haskell-language-server-1.8.0.0
Downloaded   haskell-language-server-1.8.0.0
Unpacking to haskell-language-server-1.8.0.0/
[ Info  ] Building HLS 1.8.0.0 for GHC version 9.2.4
[ cabal ] After searching the rest of the dependency tree exhaustively, these were the
[ cabal ] goals I've had most trouble fulfilling: haskell-language-server,
[ cabal ] hls-plugin-api, hls-stylish-haskell-plugin,
[ cabal ] haskell-language-server:stylishhaskell
[ cabal ] Try running with --minimize-conflict-set to improve the error message.
[ cabal ] 
[ Error ] BuildFailed failed in dir /home/jesse/.ghcup/tmp/ghcup-37449d1c45c8e46c/haskell-language-server-1.8.0.0: Process "cabal" with argu
ments ["v2-install",
[ ...   ]                                                                                                                                   
       "-w",
[ ...   ]                                                                                                                                   
       "ghc-9.2.4",
[ ...   ]                                                                                                                                   
       "--install-method=copy",
[ ...   ]                                                                                                                                   
       "--overwrite-policy=always",
[ ...   ]                                                                                                                                   
       "--disable-profiling",
[ ...   ]                                                                                                                                   
       "--disable-tests",
[ ...   ]                                                                                                                                   
       "--installdir=/home/jesse/.ghcup/tmp/ghcup-37449d1c45c8e46c/haskell-language-server-1.8.0.0/out/9.2.4",
[ ...   ]                                                                                                                                   
       "--project-file=cabal.project",
[ ...   ]                                                                                                                                   
       "exe:haskell-language-server",
[ ...   ]                                                                                                                                   
       "exe:haskell-language-server-wrapper"] failed with exit code 1.

I've tried uninstalling and reinstalling tools through ghcup in different orders, deleting ~/.cabal and ~/.stack and running cabal update fresh.

I have not tried different ghc versions because the project I am working on requires 9.2.4.

istathar commented 1 year ago

Does anyone know how to get a haskell-language-server from Nix for a given compiler? Our project's stack.yaml / snapshot.yaml specify ghc-9.2.4 and lts-20.1 just fine but getting an HLS binary to match has proven tricky and is causing Haskell support in VS Code to crash.

Also, https://github.com/haskell/haskell-language-server/issues/1926#issuecomment-1333685252 may be relevant.

georgefst commented 1 year ago

I've hit the same error as OP with HLS 1.9.1.0 since upgrading to GHC 9.4.4, with everything being installed via GHCUp. What's very odd is that the failure seems to depend on which HLS is set as the default, rather than which one is actually used:

I'm on Manjaro Linux, which uses the Fedora GHC binaries.

@hasufell Since this seems like it could be a GHCUp distribution issue, any ideas?

hasufell commented 1 year ago

@georgefst https://github.com/haskell/haskell-language-server/issues/3497

georgefst commented 1 year ago

@georgefst #3497

Thanks! Good to see that the problem is known and understood (even if it doesn't explain most earlier comments in this thread).

fosskers commented 10 months ago

This has recently started happening to me again with GHC 9.6.4.

Vlix commented 10 months ago

I had the same happen recently with 9.6.3 and 9.6.4, yeah 🤔 When working on the password library to update it to accept base64-1.0, I bumped the Stack LTS and when using 9.6.3/4 it kept complaining about mismatching ABI, so I used 9.4.8 locally.

fosskers commented 10 months ago

Confirmed that reverting my LTS snapshot to point to 9.4.x fixes the issue, and my LSP boots now.

hasufell commented 10 months ago

@fosskers If you use stack, then the HLS binaries may not be compatible. This is known, because stack doesn't pick GHC bindists as ghcup does.

You can fix that with the stack-ghcup integration: https://www.haskell.org/ghcup/guide/#strategy-1-stack-hooks-new-recommended

fosskers commented 10 months ago

Oh interesting, thank you.

fosskers commented 10 months ago

Confirmed! My stack is now using GHC's pulled via ghcup. And hls uses these newer GHCs without issue. Thank you.