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

Cabal does not consider GHC ABI #8114

Closed
hasufell opened this issue Apr 26, 2022 · 9 comments · Fixed by #9618
Closed

Cabal does not consider GHC ABI #8114

hasufell opened this issue Apr 26, 2022 · 9 comments · Fixed by #9618

Comments

@hasufell
Copy link
Member

hasufell commented Apr 26, 2022

Cabal assumes that ABI is stable across ghc --numeric-version, both for the cabal store artifacts, as well as for the dist-newstyle/ artifacts.

However, this assumption is wrong. GHC has no ABI stability and two bindists of the same version, for the same architecture and platform can have diverging ABI.

One instance of this is https://gitlab.haskell.org/ghc/ghc/-/issues/21423

@andreasabel

@gbaz
Copy link
Collaborator

gbaz commented Apr 26, 2022

If I recall we decided that this was an issue that would be solved with the ghc build system -- in particular ghc distributions needed to calculate and store an abi-hash with their own bundled libraries?

@gbaz
Copy link
Collaborator

gbaz commented Apr 26, 2022

cc @bgamari who hopefully remembers this.

@hasufell
Copy link
Member Author

hasufell commented Apr 26, 2022

@wz1000 was involved in some of the ABI hash generation stuff: haskell/haskell-language-server#2675 (comment)

But I can't find the so called ghc-abihash package from the linked MR anymore: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5965

The HLS wrapper scripts just construct the ghc abi hash from the hashes of all boot libraries (ghc-pkg field <pkg> abi --simple-output). Cabal could do the same, but it would for sure be better if GHC has an API to query the ABI hash.

@jneira
Copy link
Member

jneira commented Apr 26, 2022

imho it is clear that ghc should be able to tell us its abi and no fix downstream all tools which depends on it
fortunately cabal nor cabal-install depends statically on ghc and users could workaround using a dedicated store or build dir if abi changes cause issues (iiuic not always is the case)

@hasufell
Copy link
Member Author

imho it is clear that ghc should be able to tell us its abi and no fix downstream all tools which depends on

I'm not sure I follow. Figuring out the ABI is easy (as explained above), there's just no official API to query it for GHC, so you won't get cross-tool consistency. That doesn't really block fixing it, though.

users could workaround using a dedicated store or build dir if abi changes cause issues (iiuic not always is the case)

ABI breakages aren't easily visible to users, unless they hit obscure errors. So I don't think there's a reasonable workaround.

@mpickering
Copy link
Collaborator

To be clear the issue here is in particular object files, not the interface (.hi) files, which are safe to share across compilers with the same numeric version.

@jneira
Copy link
Member

jneira commented May 1, 2022

So the action would be replace the uses of ghc numeric version with the ghc abi hash?
So cabal would have a dedicated directory for each ghc abi hash in the store and build dirs?

@hasufell
Copy link
Member Author

@hasufell
Copy link
Member Author

@phadej do you know if package ABI ever makes it into the hash?

sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 12, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
sol added a commit to sol/cabal that referenced this issue Oct 25, 2023
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
alt-romes pushed a commit to alt-romes/cabal that referenced this issue Jan 16, 2024
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
alt-romes pushed a commit to alt-romes/cabal that referenced this issue Jan 16, 2024
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
Mikolaj pushed a commit to alt-romes/cabal that referenced this issue Jan 19, 2024
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
@mergify mergify bot closed this as completed in #9618 Jan 19, 2024
erikd pushed a commit to erikd/cabal that referenced this issue Apr 22, 2024
- This allows the use of several **API incompatible builds of the same
  version of GHC** without corrupting the cabal store.
- This relies on the "Project Unit Id" which is available since GHC
  9.8.1, older versions of GHC do not benefit from this change.

[fixes haskell#8114]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants