Ghc abi mismatch for hls when using ghc942

i am trying to build my flake with a more recent version of ghc specifically 9.4.2 and it compiles fine however in the shell given by nix develop hls doesn’t work.
when i run haskell-language-server-wrapper typecheck it gives a message about ghc abi mismatch, and shows different hashes for the mentioned libraries

1 Like

In general, HLS needs to be compiled with the exact same compiler you used to compile your project. In theory, the GHC ABI mismatch is telling you that you’ve used two slightly different compilers, so HLS may not work as expected. (Did you install HLS system-wide, but pin a different Nixpkgs version in your local project or something like that?)

Could you share your nix files? It is hard to debug without actually seeing the Nix setup you’re using.

Also, ping @maralorn since he’s a lot more familiar with all the moving parts here.

1 Like

my flake.nix file is a simple modification of the haskell-hello template so i will detail the commands to get the error to show as that will be shorter

nix flake init -t "templates#haskell-hello"
sed -i 's/\.haskellPackages/\.haskell\.packages\.ghc94/g' flake.nix # change ghc version
sed -i '/ghcid/s/$/e/' flake.nix # use ghcide instead of ghcid
nix flake update  # the template comes with a lock file from 2021
nix develop

then on the provided shell try using haskell-language-server-wrapper
upon doing this you will see the problem. i am thinking the problem is with the packaging of hls as if you change ghc94 to ghc92 it works so the problem isn’t a different version to 8.10.
i do have nixpkgs pinned system wide however that shouldn’t matter as the hls binary should be from the same nixpkgs version than the ghc binary and i don’t have either ghc or hls in path.

This issue seems to be a fresh regression on unstable, I can reproduce it and it has also been reported on github:

1 Like