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
Link-time error after changing a dependency #5473
Comments
@gergoerdi would you mind creating a simple project to reproduce this? In that case I could take a look into what's going on here. |
Sure, I will try to make a small self-contained way of reproducing it (hopefully by tomorrow). In the meantime, https://github.com/gergoerdi/clash-issue-1536/tree/memory-map-th should be the full code, including the |
Minimizing preproduction will help a lot, thank you. |
OK I have uploaded a fully self-contained, reproducing repo to https://github.com/gergoerdi/stack-issue-5473
|
Yeah, great, reproduced it locally |
@gergoerdi it looks like you've found a hole in Pantry design :) |
So wouldn't a straightforward fix here be to include, in the identifier of a dependency, a hash of (the hash of) all its dependencies? |
Nix-like way (when all inputs in theory determine the resulting output) makes sense but that's not quite how Stack works. In principle when checking already compiled libraries deps are also taken into account but it looks like in this case for some reason package identifiers (from ghc-pkg) for |
@qrilka Thank you for looking into this. I'm hitting this bug as well, and I reported it as #5501 (before I found this issue). I've experienced this a couple of times now, and I very often update git dependencies, so it happens fairly rarely. I was quite happy that I was able to reproduce it in a Docker container (see #5501). This reproduction may provide an extra data point in figuring out what's going on. But I'm happy to see that this issue has a more minimal reproduction. For both reproductions, the bug is triggered when a git dependency commit hash is changed to a version where an export is added to an existing module. This is the diff between the dependency versions that causes the error for this issue's reproduction: gergoerdi/clash-compiler@d83b5cc...6241177, and this is the diff between the dependency version that causes the error for my reproduction: runeksvendsen/bellman-ford@a089bfe...45bfb65. In both cases the linker error refers to the added exports (modules |
@runeksvendsen as I've written above it looks like Stack doesn't see the update and reusing old library clearly causes problems. Unfortunately I didn't have time yet to look more into it. |
Update cache image to avoid commercialhaskell/stack#5473
After coming back to this ticket now I see that |
@gergoerdi I had another look into the details of this and it appears that for some reason |
I have no idea. Package ID is one of those concepts that seems to have changed significantly over time, and I have no idea what we can or cannot rely upon in the Cabal or GHC worlds anymore. |
Looks like I just ran into this as well, ironically while building a repro for a different bug in a different library: https://github.com/chreekat/r2-repro/ I say "Uncomment to try the fix", but that doesn't work because I just get a bunch of linker errors. :P |
On Stack 2.5.1, I am using the following resolver file:
After a full
stack build
in my project, I then want to change the version of Clash used, so I change the git commit hash to62411778020b09433744d267acd5aa3deb85b04f
. Subsequently,stack build
fails at link time with an error message referencing a symbol that has been removed from Clash between the two Git commits:I tried removing
.stack-work
and*/.stack-work
, but the problem persists. It seems like I would need to nuke~/.stack/
, just like in the bad old Cabal days.The text was updated successfully, but these errors were encountered: