Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ABI mismatches of GHC bindists #2865

Open
hasufell opened this issue Apr 28, 2022 · 5 comments
Open

ABI mismatches of GHC bindists #2865

hasufell opened this issue Apr 28, 2022 · 5 comments

Comments

@hasufell
Copy link
Member

GHC 9.0.2 on linux and 9.2.2 on windows had missing profiling libs so @mpickering was so kind to supply me with fixed bindists.

These were added to ghcup: haskell/ghcup-metadata@88696a0

Since profiling seems to affect the ABI, this caused a number of issues:

The latter being that stack with GHC 9.0.2 doesn't work with HLS, because they still use the old bindist without profiling libs, causing ABI mismatch in our wrapper script:

if [ "${ABI_HASHES}" != "${MY_ABI_HASHES}" ] ; then

This begs the question on how to deal with such diverging ABI. I see a couple of potential solutions:

  1. coordinate bindist updates with stack team
  2. have hls-wrapper binary pick the correct ABI (in addition to correct GHC version) and ship multiple hls binaries, such as haskell-language-server-<ghcver>-<abihash>
  3. somehow integrate better with stack and require users to use ghcup for GHC installation (see Support custom GHC installation hooks commercialhaskell/stack#5585)
  4. make compiling from source more robust, so that e.g. the VSCode extension could compile HLS from source on ABI mismatch instead of giving up

Also note that there may be other cases where ghcup and stack bindists diverge, e.g. because they have different platform detection logic.

@hasufell
Copy link
Member Author

Also note that fixing ABI stability seems to be impossible according to @bgamari due to cross module optimization of GHC, so we're left with fixing this through distribution.

@cdepillabout
Copy link
Contributor

@hasufell
Copy link
Member Author

The stack PR with ghc installation hooks was merged... so we should be able to guide users on how to install GHC through ghcup via stack in the future to avoid these types of issues again: commercialhaskell/stack#5585

@thisisrandy
Copy link

thisisrandy commented Jul 29, 2022

I'm in the early stages of learning haskell and ran into this issue on my first attempt at creating a project. I asked about it on SO and was eventually pointed to this issue. While I understand the problem well enough, I don't understand the solution, if indeed the GHC installation hooks PR is that. Would you mind laying it out for a newbie with only a vague sense of the haskell toolchain or pointing to existing docs that do just that? I get that your PR was just merged and as such isn't in the latest stack release, and I'm not sure building stack myself is a great idea at this point in my learning exercise, but maybe you could answer assuming the PR has been released or however you think is most appropriate.

@hasufell
Copy link
Member Author

@thisisrandy see https://github.com/haskell/vscode-haskell#ghc-abis-dont-match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants