-
Notifications
You must be signed in to change notification settings - Fork 704
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-install seems to pick wrong library versions in Template Haskell splices if there are multiple versions in the store #6412
Comments
I'm quite sure the root cause is the same (mystical one) as in #6211 and #5782 However, we failed to find out how to reproduce that (this ?) issue reliably, so the best we can do now is "wipe the store, start over". Correction: except that grayjay got a repro-case in #5782, I haven't tried it yet myself though. |
We’re seeing this on our CI servers now. 😭 We’ve worked around this locally: https://github.com/github/semantic/blob/c78529d06187ee09ccf5dc4b5f6fb47788403eab/script/fix-broken-cabal-store |
@phadej is there reason to believe that this would affect public sub-libraries as well as private internal libraries? |
@patrickt we are woking around using a separate |
Closing as duplicate of #5782, according to Oleg's hunch. @patrickt: could you kindly try to reproduce this problem with a current stable cabal? We are guessing in #5782 (comment) this issue is fixed in new stable cabals, but we'd love as much confirmation as we can get. @robrix: yes, I guess it was likely to affect both private and public internal libraries. Let's hope it does not longer. |
Describe the bug
In the course of developing https://github.com/github/semantic and https://github.com/tree-sitter/haskell-tree-sitter, several of us have encountered a mysterious bug in which a library dependency, during execution of a Template Haskell splice, appears to link in an incorrect library version if there are multiple versions of this library present in the store. This has happened across a number of
cabal-install
versions; I use v3.0.Behavior
After some time spent developing in a given checkout of
semantic
, the package store gets into a state where invokingcabal build
triggers a rebuild of our dependencies:Things start to go awry when we compile the
tree-sitter-*
subpackages.Each of these subpackages consists of a library and an internal library. The internal library contains generated C code, and the library itself runs a Template Haskell splice (defined in the base
tree-sitter
library) to generate and expose data types based on the symbols defined by this internal library. (I understand that it may be unconventional to do this level of work in a TH splice, including FFI invocations, but we have quite specific requirements.) At this point, that TH splice fails with an error suggesting that the wrong version of a library has been linked in:This repeats itself for all the
tree-sitter-*
packages. It seems to imply that there are twotree-sitter
packages in the store, and that thetree_sitter_json
identifier being used here is linked to a different version than is this invocation ofmkSymbolDatatype
.To Reproduce
I have not been able to figure out how to reproduce this behavior from a clean checkout. It tends to happen when
~/.cabal/store
contains a great deal of duplicated packages: here’s a list of what’s present in.cabal/store
that’s currently displaying this behavior. (Note that there are twotr-sttr
entries; I presume that different ones are being picked at different phases. If it’s helpful, I’m happy to upload the entirety of my.cabal
directory, though its size (4.5GB) is considerable. Removingdist-newstyle
in thesemantic
folder doesn’t change the behavior; the only thing I’ve found that fixes it is nuking~/.cabal/store
and~/.cabal/packages
, which entails a bit of recompilation.Expected behavior
This should finish building.
System information
cabal
version 3.0.0.0,ghc
version 8.6.5.Additional context
I realize that this is somewhat of an involved bug, so if this is a consequence of some way in which we are using the tooling wrong, I’m happy to accept any suggestions as to how we can better address this, and to provide any other information that you might need.
The text was updated successfully, but these errors were encountered: