haskell / haskell-language-server

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

GHC ABIs don't match #2984

Closed dewijones92 closed 2 years ago

dewijones92 commented 2 years ago

Your environment

Which OS do you use: Docker, Linux Which LSP client (editor/plugin) do you use: Just running it from cli haskell-language-server-wrapper -d --lsp

Describe your project (alternative: link to the project): stack new helloworld new-template
https://github.com/dewijones92/helloworld2

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. {"jsonrpc":"2.0", "method":"window/showMessage", "params": {"type": 1, "message": "Couldn't find a working/matching GHC installation. Consider installing ghc-9.0.2 via ghcup or build HLS from source."}}

Include debug information

I already have ghc-9.0.2 installed. So I am not sure what I am doing wrong. Help please? :)

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.7.0.0 x86_64 ghc-9.2.2
Current directory: /work_dir
Operating system: linux
Arguments: ["-d","--lsp"]
Cradle directory: /work_dir
Cradle type: Stack

Tool versions found on the $PATH
cabal:          3.6.2.0
stack:          2.7.5
ghc:            9.0.2

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

Expected: Cabal-3.4.1.0:a051cbb7ec9414fe5c6bba0f2440ca6f array-0.5.4.0:12d231d39fc79c4087784cfc76871ff1 base-4.15.1.0:117e938cf6fcf64994ba3aef31cf603b binary-0.8.8.0:b03d6ad27860afe51ebc9e3248434d15 bytestring-0.10.12.1:e4975cf6178d812dc2f2c81e8c9be30a containers-0.6.4.1:9e430426211bfe32963d8bab27806a35 deepseq-1.4.5.0:60e8456f6f65cd151c88cc410666c621 directory-1.3.6.2:f1a3311e8ba1cc9b036e750630486656 exceptions-0.10.4:049d2f1a78b2a52e75e404ab9c2f911a filepath-1.4.2.1:9e1d21996ba8a0ef6e4fec52f4d98047 ghc-9.0.2:c9341caacf944d1cb02c6c7861312d0f ghc-bignum-1.1:b0d937701db7f86f956f5cb389f77cca ghc-boot-9.0.2:28d9afefd19ea04817764809bab95f5f ghc-boot-th-9.0.2:9babe69361f2f68170e2dbbe88e4983e ghc-compact-0.1.0.0:0bc4a56a3c08aabaaac31c1bc3dd447f ghc-heap-9.0.2:43a05401bc5123b09d707a57ddc4490a ghc-prim-0.7.0:588a3991c8614cf55b0ea6e8691427c9 ghci-9.0.2:375f008703e8d815f52de5b05fc02c86 haskeline-0.8.2:28bbf0e5ba2e25f3d54ad4027a9ede9e hpc-0.6.1.0:77374bb63901ebc16c39493457ca3257 integer-gmp-1.1:e70d28fc0163ba560bc384145244cb69 libiserv-9.0.2:95c3b45219d19ccd9b5595ae6e7c7908 mtl-2.2.2:52aef1cfcdfee928163df37509fd5fcf parsec-3.1.14.0:be437bae1f0ba898a01efcc0b771edc4 pretty-1.1.3.6:3f641d957a4348e6ea36c600ba833c8f process-1.6.13.2:f23adc5e02c1771a430d88d6a1abd971 rts-1.0.2: stm-2.5.0.0:b17651bd52d0ff482dc6779169d3505e template-haskell-2.17.0.0:f5b1731c7c7b1ffc1f184cdbd4132cc8 terminfo-0.4.1.5:07487f60122f169efa9bd7811101cd95 text-1.2.5.0:9c95aed37b6218c51e66f91050496e31 time-1.9.3:ad92beb34309578e2b12ce85a9543cee transformers-0.5.6.2:e16c61ffe1a43491b0e7bd74127e49be unix-2.7.2.2:afee94d055b16c0950b6b6205e8b17d8 xhtml-3000.2.2.1:7b59f11d5f554f284e9c296f46f4ec38
Got:      Cabal-3.4.1.0:ab74f2c3161b496273c112bc304128c5 array-0.5.4.0:60b03bb14f2fb672c7d45b226c353ec1 base-4.15.1.0:b7bb9d150077ce1eefa2cb650417b227 binary-0.8.8.0:fa88338820a9bd0b504bf213a8e72719 bytestring-0.10.12.1:28912719bcbb836263ecf818c4004d98 containers-0.6.4.1:bf00c7599db8af6c073a044b172248dc deepseq-1.4.5.0:0cf68babae66ababbe71ea47b01804fa directory-1.3.6.2:b82e95002902f0bdb50c05dc51b225ca exceptions-0.10.4:a3c9fa639722ef9d50341c6cd2385d93 filepath-1.4.2.1:f9de4a7f0f552804d24b9223eb693d53 ghc-9.0.2:0cab42b9f0b20868d0736b02935b8866 ghc-bignum-1.1:15967d121cc201c802258aaa5c934bcb ghc-boot-9.0.2:039cdff4f5fc2e0f39b30a6c78d62d65 ghc-boot-th-9.0.2:1fac6b56dc58f2dcc9db351a93d9ba82 ghc-compact-0.1.0.0:d89810b7bdcf2139de5c6556a1ac4a7f ghc-heap-9.0.2:15ea845dceccc5a82c8f166b98b06abb ghc-prim-0.7.0:73976e16cfa5a2a403911029813074eb ghci-9.0.2:44e4f88c631e291af61ce91b76fbea09 haskeline-0.8.2:5361530f9aec03de9188d994aa62c524 hpc-0.6.1.0:b68473d0ac443f4d1d885c4e320214e9 integer-gmp-1.1:6e51ea8b50a9fe5db3b235fec13d166d libiserv-9.0.2:298c71b0c3b7568c92e50683303fba08 mtl-2.2.2:281e19dd29c936cd4c9d8e152d50033f parsec-3.1.14.0:1ba7fb990e3bfe3823a06a9994c407da pretty-1.1.3.6:0afd3b4e13803cee680552ac40e3619e process-1.6.13.2:d13b828d4126001ef8415f7d2bba1fae rts-1.0.2: stm-2.5.0.0:2abafd3d3074be9dbfcd04c00dc359a8 template-haskell-2.17.0.0:0f82000709e76bc945a8f1d61f8c081d terminfo-0.4.1.5:78bfad4e1a38582ba34d5d263d1d1f75 text-1.2.5.0:cf399f9a19fcee928a7fc309096a7c48 time-1.9.3:62b52209105ec2b6827bf78dfbd8cb45 transformers-0.5.6.2:2a63be5f37cb981a011ed62743dba8c8 unix-2.7.2.2:db9a0e7818cd41e42f6ec7fe4546e402 xhtml-3000.2.2.1:6106604d25403bc5424f906bf9952fe2
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.0.2 via ghcup or build HLS from source."}}
real    0m3.563s
user    0m0.025s
sys     0m0.034s`
mouse07410 commented 2 years ago

I'm not sure I understand the problem:

$ stack new helloworld new-template
Downloading template "new-template" to create project "helloworld" in helloworld/ ...

The following parameters were needed by the template but not provided: category
You can provide them in /Users/ur20980/.stack/config.yaml, like this:
templates:
  params:
    category: value
Or you can pass each one as parameters like this:
stack new helloworld new-template -p "category:value"

Looking for .cabal or package.yaml files to use to init the project.           
Using cabal packages:                                                          
- helloworld/                                                                  

Selecting the best among 21 snapshots...                                       

* Matches https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/12.yaml

Selected resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/12.yaml
Initialising configuration using resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/12.yaml
Total number of user packages considered: 1                                    
Writing configuration to file: helloworld/stack.yaml                           
All done.                                                                      
/Users/ur20980/.stack/templates/new-template.hsfiles:    6.06 KiB downloaded...
$ cd helloworld
$ stack build
Building all executables for `helloworld' once. After a successful build of all of them, only specified executables will be rebuilt.
helloworld> configure (lib + exe)
Configuring helloworld-0.1.0.0...
helloworld> build (lib + exe)
Preprocessing library for helloworld-0.1.0.0..
Building library for helloworld-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_helloworld
Preprocessing executable 'helloworld-exe' for helloworld-0.1.0.0..
Building executable 'helloworld-exe' for helloworld-0.1.0.0..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_helloworld
Linking .stack-work/dist/x86_64-osx/Cabal-3.4.1.0/build/helloworld-exe/helloworld-exe ...
helloworld> copy/register
Installing library in /Users/ur20980/src/tmp/helloworld/.stack-work/install/x86_64-osx/5bc4200f41495530e031a95bb7b3e67a7fc07bb9355f615275edd7563cf8e842/9.0.2/lib/x86_64-osx-ghc-9.0.2/helloworld-0.1.0.0-A2A7VUJBGTtENB3KROKHHh
Installing executable helloworld-exe in /Users/ur20980/src/tmp/helloworld/.stack-work/install/x86_64-osx/5bc4200f41495530e031a95bb7b3e67a7fc07bb9355f615275edd7563cf8e842/9.0.2/bin
Registering library for helloworld-0.1.0.0..
$ stack run
someFunc
$ haskell-language-server-wrapper -d --lsp
Found "/Users/ur20980/hie.yaml" for "/Users/ur20980/src/tmp/helloworld/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0 x86_64 ghc-9.2.2
Current directory: /Users/ur20980/src/tmp/helloworld
Operating system: darwin
Arguments: ["-d","--lsp"]
Cradle directory: /Users/ur20980
Cradle type: Multi

Tool versions found on the $PATH
cabal:      3.6.2.0
stack:      2.7.5
ghc:        9.0.2

Consulting the cradle to get project GHC version...
Project GHC version: 9.0.2
haskell-language-server exe candidates: ["haskell-language-server-9.0.2","haskell-language-server"]
Launching haskell-language-server exe at:/Users/ur20980/.ghcup/bin/haskell-language-server-9.0.2
2022-06-23T03:00:13.149475Z | Info | No log file specified; using stderr.
2022-06-23T03:00:13.154066Z | Info | haskell-language-server version: 1.7.0.0 (GHC: 9.0.2) (PATH: /Users/ur20980/.ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin/haskell-language-server-9.0.2)
2022-06-23T03:00:13.156038Z | Info | Directory: /Users/ur20980
2022-06-23T03:00:13.156284Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas
             , floskell
             , fourmolu
             , tactics
             , ormolu
             , rename
             , retrie
             , brittany
             , callHierarchy
             , class
             , haddockComments
             , eval
             , importLens
             , qualifyImportedNames
             , refineImports
             , moduleName
             , hlint
             , splice
             , alternateNumberFormat
             , selectionRange
             , changeTypeSignature
             , ghcide-hover-and-symbols
             , ghcide-code-actions-imports-exports
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , ghcide-code-actions-fill-holes
             , ghcide-completions
             , ghcide-type-lenses
             , ghcide-core
             , LSPRecorderCallback ]
2022-06-23T03:00:13.161369Z | Info | Logging heap statistics every 60.00s
 2022-06-23T03:00:13.196642Z | Info | Staring LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!

MacOS 12.4, Cabal-3.6.2.0, Stack-2.7.5, GHC-9.0.2, HLS-1.7.0.0.

dewijones92 commented 2 years ago

@mouse07410 this fixed it adding this: system-ghc: true

Found it here https://www.reddit.com/r/haskell/comments/uk5wg7/comment/i7n990t/?utm_source=reddit&utm_medium=web2x&context=3