Skip to content
New issue

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

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

Already on GitHub? # to your account

haskell-language-server: GHC ABIs don't match! #321569

Closed
flandweber opened this issue Jun 21, 2024 · 5 comments
Closed

haskell-language-server: GHC ABIs don't match! #321569

flandweber opened this issue Jun 21, 2024 · 5 comments
Labels

Comments

@flandweber
Copy link
Contributor

Describe the bug

When trying to start the haskell-language-server (haskell.packages.ghc965.ghcWithHoogle (hpkgs: with hpkgs; [cabal-install stack haskell-language-server ])
it gives an ABI error because of version hash differences:

$ haskell-language-server-wrapper
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.8.0.0 x86_64 ghc-9.6.5
Current directory: /
Operating system: linux
Arguments: []
Cradle directory: /
Cradle type: Default

Tool versions found on the $PATH
cabal:          3.10.3.0
stack:          2.15.7
ghc:            9.6.5


Consulting the cradle to get project GHC version...
2024-06-21T16:59:18.588850Z | Debug | ghc --numeric-version
Project GHC version: 9.6.5
haskell-language-server exe candidates: ["haskell-language-server-9.6.5","haskell-language-server"]
Launching haskell-language-server exe at:/etc/profiles/per-user/dtszfn/bin/haskell-language-server-9.6.5
2024-06-21T16:59:18.705504Z | Debug | ghc -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-06-21T16:59:18.740232Z | Debug | ghc --print-libdir
GHC ABIs don't match!

Expected: Cabal-3.10.3.0:60baabdb009c53159cad76be26725f08 Cabal-syntax-3.10.3.0:f468cedfeb0e9f2cd52ae519b0ae4a54 array-0.5.6.0:b258b1ceb08c949c20b0bce7b0ea90f3 base-4.18.2.1:5e76e08f29d0c3588c27208e17fbe7ea binary-0.8.9.1:5fe0b4a3de384781c5dc1032dc02601e bytestring-0.11.5.3:40396badf7213e1a86242b6a09b805e6 containers-0.6.7:6df0ebc82028c73452fda4962112a6cf deepseq-1.4.8.1:4060565212c9942a1862089c5875adee directory-1.3.8.4:db4a22421f8d22e8d3f55c8debd84b48 exceptions-0.10.7:756d769aca4947fcc2f1a767b7b415e6 filepath-1.4.300.1:736a16c664129ed475a6ae1f3bb5833d ghc-9.6.5:f23b830a1bc36756a2e4819496e4cd5a ghc-bignum-1.3:57e6bfd386f81c60ba6aecaa93f2e778 ghc-boot-9.6.5:a255be35cd992c265aee6903e0be9db6 ghc-boot-th-9.6.5:c12b258abe3df9bbe567c189d16d2986 ghc-compact-0.1.0.0:f567616e89d6607eae662483e40292ad ghc-heap-9.6.5:487a6bcb2dbdc368782621035313f323 ghc-prim-0.10.0:cce933d7b92b1d456e4b5f787794abfc ghci-9.6.5:00303979259faef9d1e8382c70514e54 haskeline-0.8.2.1:623e1dcadb2f420a6a04f293ed1a4c21 hpc-0.6.2.0:35194ae300dfd2323332616f1f3517e4 integer-gmp-1.1:c2f1c75a8177e4e5167a9d9aef9be135 libiserv-9.6.5:18b79a06676fd08ea0afe5444bed4848 mtl-2.3.1:204a6e7e13f8feb89a9243aad0573a22 parsec-3.1.16.1:b89d7b90c99f12d58bbecdbce5ccc789 pretty-1.1.3.6:990ce4da0deb21a3db4ee5c912f16866 process-1.6.19.0:bb8ff62cb7610343fa3dc5588940fed3 rts-1.0.2:644bdf6b649a4408db1a937cc6e8878c stm-2.5.1.0:4e298e5d945565149dc7368e268974ea system-cxx-std-lib-1.0:00000000000000000000000000000000 template-haskell-2.20.0.0:81dbb91cfc4fe2455c4dbef73250b644 terminfo-0.4.1.6:baed98c12629c46c1b8c3b0ec0f651b8 text-2.0.2:6e300924c40132ba00575c1206613d0a time-1.12.2:51ba4852be4a34bfbdf21e898881b19c transformers-0.6.1.0:e6c8ae587e2a6391519475b4e0fb752e unix-2.8.4.0:ffd7a78c5eebf8cde5de02d7848dd03d xhtml-3000.2.2.1:4d0198f87056f4d32e59a25e608492bc
Got:      Cabal-3.10.3.0:42f1f59dd74a7b06e17211a22e6c0345 60baabdb009c53159cad76be26725f08 Cabal-syntax-3.10.3.0:f468cedfeb0e9f2cd52ae519b0ae4a54 9cfb7409209b04ceadf8e0349d730287 array-0.5.6.0:b258b1ceb08c949c20b0bce7b0ea90f3 base-4.18.2.1:5e76e08f29d0c3588c27208e17fbe7ea binary-0.8.9.1:5fe0b4a3de384781c5dc1032dc02601e bytestring-0.11.5.3:40396badf7213e1a86242b6a09b805e6 containers-0.6.7:6df0ebc82028c73452fda4962112a6cf deepseq-1.4.8.1:4060565212c9942a1862089c5875adee directory-1.3.8.4:db4a22421f8d22e8d3f55c8debd84b48 exceptions-0.10.7:756d769aca4947fcc2f1a767b7b415e6 filepath-1.4.300.1:736a16c664129ed475a6ae1f3bb5833d ghc-9.6.5:f23b830a1bc36756a2e4819496e4cd5a ghc-bignum-1.3:57e6bfd386f81c60ba6aecaa93f2e778 ghc-boot-9.6.5:a255be35cd992c265aee6903e0be9db6 ghc-boot-th-9.6.5:c12b258abe3df9bbe567c189d16d2986 ghc-compact-0.1.0.0:f567616e89d6607eae662483e40292ad ghc-heap-9.6.5:487a6bcb2dbdc368782621035313f323 ghc-prim-0.10.0:cce933d7b92b1d456e4b5f787794abfc ghci-9.6.5:00303979259faef9d1e8382c70514e54 haskeline-0.8.2.1:623e1dcadb2f420a6a04f293ed1a4c21 hpc-0.6.2.0:35194ae300dfd2323332616f1f3517e4 integer-gmp-1.1:c2f1c75a8177e4e5167a9d9aef9be135 libiserv-9.6.5:18b79a06676fd08ea0afe5444bed4848 mtl-2.3.1:204a6e7e13f8feb89a9243aad0573a22 parsec-3.1.16.1:b89d7b90c99f12d58bbecdbce5ccc789 pretty-1.1.3.6:990ce4da0deb21a3db4ee5c912f16866 process-1.6.19.0:bb8ff62cb7610343fa3dc5588940fed3 rts-1.0.2:644bdf6b649a4408db1a937cc6e8878c stm-2.5.1.0:4e298e5d945565149dc7368e268974ea system-cxx-std-lib-1.0:00000000000000000000000000000000 template-haskell-2.20.0.0:81dbb91cfc4fe2455c4dbef73250b644 terminfo-0.4.1.6:baed98c12629c46c1b8c3b0ec0f651b8 text-2.0.2:6e300924c40132ba00575c1206613d0a time-1.12.2:51ba4852be4a34bfbdf21e898881b19c transformers-0.6.1.0:e6c8ae587e2a6391519475b4e0fb752e unix-2.8.4.0:ffd7a78c5eebf8cde5de02d7848dd03d xhtml-3000.2.2.1:4d0198f87056f4d32e59a25e608492bc
Content-Length: 203

{"jsonrpc":"2.0", "method":"window/showMessage", "params": {"type": 1, "message": "Couldn't find a working/matching GHC installation. Visit https://nixos.org/manual/nixpkgs/unstable/#haskell-language-server to learn how to correctly install a matching hls for your ghc with nix."}}

When comparing the versions it shows that the command adds some version hashes without package names.

Seems related to #199834, but I don't understand the problem well enough to be certain.

Notify maintainers

@maralorn

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.4, NixOS, 24.05 (Uakari), 24.05.20240619.dd457de`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `""`
 - nixpkgs: `/nix/store/2lvj8bm21ymxra61dqrc4xpzr8njgywj-source`

(flake-based: github:nixos/nixpkgs/dd457de7e08c6d06789b1f5b88fc9327f4d96309)


Add a 👍 reaction to issues you find important.

@flandweber flandweber added the 0.kind: bug Something is broken label Jun 21, 2024
@maralorn
Copy link
Member

Thanks for reporting this. That ABI mismatch detection is sadly a bit brittle. I will investigate.

@maralorn
Copy link
Member

maralorn commented Jul 7, 2024

Okay, as step 1 I can offer a workaround:
The second version of Cabal and Cabal-syntax (which does, but should not fail this check) is introduced by cabal-install. Since you most likely only want to use cabal-install and not develop against it you can dodge this problem by not installing cabal-install (and stack) as dependencies of your Haskell package but just install pkgs.cabal-install additionally as a system package (e.g. the buildInputs of a shell.nix). Then the binary will be available without polluting your Haskell package set.

@maralorn
Copy link
Member

maralorn commented Jul 7, 2024

Okay, after further investigation: This is not a regression but a case which I think never worked. The haskell-language-server shell wrapper which detects mismatches in core dependencies will fail if you have multiple versions of a ghc boot package present at runtime.

For the time being my above mentioned workaround should alleviate this problem, but this is of course annoying. I will need to confer with HLS upstream about this as that wrapper script is directly out of the hls repo.

Thanks again for the report.

@maralorn
Copy link
Member

maralorn commented Jul 7, 2024

I have figured out two fixes for your problem:

  • I think the override for cabal-install which introduces the additional Cabal version is not neccessary, so I will try to drop this.
  • I don’t think Cabal is relevant to the ABI match that HLS requires, so I will try to reduce the list of packages which we check for to not include Cabal.

@flandweber
Copy link
Contributor Author

Great, it works as you described.
Thank a lot for the solution and explanation!

I did work at some point at 23.11, but from what I understand this might have been a happy coincidence.

maralorn added a commit to maralorn/nixpkgs that referenced this issue Jul 7, 2024
…ches for

Inspired by: haskell/haskell-language-server#3214 (comment)

It should be enough to check only for ghc and template-haskell

Fixes NixOS#321569
shahinism pushed a commit to shahinism/nixpkgs that referenced this issue Jul 15, 2024
…ches for

Inspired by: haskell/haskell-language-server#3214 (comment)

It should be enough to check only for ghc and template-haskell

Fixes NixOS#321569
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants