-
Notifications
You must be signed in to change notification settings - Fork 848
GHC's -package <pkg>
can expose installed package not listed by ghc-pkg list <pkg>
#6661
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
Comments
Looking at the gist, one thing that is odd is that the unofficial version of Stack 2.15.7 that you are using itself lists EDIT: Actually, that is a red-herring. I see that where a package has a sub-library (for example, |
I tried with both Also just noting here too (as I mentioned in matrix) that I couldn't reproduce in a fresh Fedora container. |
I uploaded the stack-3.1.1 output too for completeness: https://gist.github.com/juhp/e4f92e6df99524da0d7df72afe2470d4 |
Also I also tried in a container first building with lts-22.41 and then lts-22.43, but this also worked fine. |
I am wondering if this GHC bug is relevant: |
Ah yes indeed - I had quite forgotten about that problem 😢 Is there a related stack issue? |
-package <pkg>
can expose installed package not listed by ghc-pkg list <pkg>
@juhp, I have edited this issue to make it Stack's related issue. |
BTW I finally "took the (small) plunge" and tried moving (aka "deleting") So wonder what triggers this on my machine, since it appears not reproducible, or is it just bad luck? Guess I forgot to write down my workaround, just in case anyway one should hit this somehow, in stack.yaml:
|
Hmm, I am wondering if this interference is actually caused by the system library packages? Because now I started to get the same problem locally with Stackage LTS 23 after upgrading system (distro) Haskell to ghc-9.8.4: it wasn't happening before with lts-23 when the system ghc and libraries were based on ghc-9.6. Further after the upgrade, I no longer need my workaround hack for lts-22, which suggests my hypothesis may be correct. I am not sure how to differentiate ghc boot/core libs from other Haskell system libraries though for stack. I am now building with stack-3.1.1 btw. |
But the biggest problem now for me is that the previous workaround no longer works with lts-23: or perhaps i need different package workaround this time - which is quite annoying. |
@juhp, the problem is packages that have a sub-libary. e.g |
@juhp, on second thoughts, please can you elaborate on what you are currently experiencing. I'd like to be able to reproduce what you are experiencing - ideally, with a simple example. |
Thanks for the comments - yeah I am still trying to understand or untangle the problem (or problems) better. Another data point: after running
This might be separate/unrelated or not, but seems relevant perhaps - it might instead relate to a successful build I did in a toolbox container (ie with shared home) without the Fedora Haskell libs installed. So maybe we ignore this ^^ anomaly for now. But yes I would like to be able to reproduce this too. The nomenclature may be a little confusing: by "system libraries" I am talking about Haskell libraries outside of ghc installed in a Fedora system; ie these are global libraries and so in some sense difficult to distinguishable from core libs. Anyway AFAICT my problem only happens with the Fedora Haskell libraries installed in the system (environment). |
Okay I was able to reproduce now in a fedora toolbox container (though it is far from a minimal reproducer - there are 791 Haskell libraries now in latest Fedora Haskell excluding ghc ones ;-). So if I build the above project (I haven't pushed the latest changes to github yet) Whereas for the build earlier (without all the Fedora Haskell libraries installed) there were 105 packages built I think. Well on the one hand I am happy/flattered that stack is leveraging the Fedora Haskell packages, but had not expected that. (Though I am also suspecting these global libraries are likely not something you want to deal with... Actually is there a stack option to ignore them?) |
Okay I have a smaller testcase now at least with a dependency on only (I guess I should double-check that it triggers the issue in a fresh pristine environment) In theory this should be reproducible in WSL2 Fedora OS say. |
I guess I could even setup a GH action to reproduce it... |
I can't reproduce in a # apt update
# apt install haskell-stack ghc git-core libghc-attoparsec-aeson-dev
# git clone https://github.com/juhp/test-stack-with-global-libs.git
# cd test-stack-with-global-libs/
# stack --system-ghc --resolver lts-22 build but I can in # history
1 cat /etc/os-release
2 dnf install stack ghc git-core
3 dnf install ghc-attoparsec-devel
5 git clone https://github.com/juhp/test-stack-with-global-libs.git
6 cd test-stack-with-global-libs/
11 stack --system-ghc --resolver lts-22 build
12 history The error will not happen if I omit step 3. Also reproduced with # history
2 dnf install stack ghc git-core ghc-attoparsec-devel
3 git clone https://github.com/juhp/test-stack-with-global-libs.git
4 cd test-stack-with-global-libs/
5 stack --system-ghc --resolver lts-22 build
7 history So far it still looks specific to fedora perhaps. (All above are with ghc-9.6.6) Earlier comments should be reproducible for $ podman run -it --rm fedora:43
# dnf install stack ghc git-core ghc-attoparsec-aeson-devel
# git clone https://github.com/juhp/test-stack-with-global-libs.git
# cd test-stack-with-global-libs/
# stack --system-ghc --resolver lts-23 build |
Thanks for the repository. I'm not using a 'system' GHC, but I could not get it to fail on:
|
Just to be quite clear, the issue is not about system GHC, but system (ie distro) libraries installed over the system GHC. |
EDIT (by @mpilgrem): The anomaly described below is likely due to the bug (from Stack's perspective) in GHC versions described at:
In short:
name
that is in the format that Cabal (the library) uses to 'mung' sub-libraries, some versions of GHC treat thatname
as if it were the name of the Cabal package for the purpose's of GHC's-package
option; and-package <pkg>
option can, in practice, cause an installed package to be exposed that is not one listed byghc-pkg list <pkg>
.Stack, on the other hand, relies on an installed package having a unique name specified by its
name
field and that GHC's-package <pkg>
option will expose only a installed package listed byghc-pkg list <pkg>
.So far noone else has seen this: so likely it is an anomaly only in my system.
General summary/comments
After updating my projects to latest lts-22 (lts >= 22.42), builds using attoparsec started to fail for me.
Steps to reproduce
(Not reproducible so far except on my laptop)
stack --resolver lts-22.43 build aeson
Expected
To build normally.
Actual
EDIT (by @mpilgrem): Some output has been reformatted for clarity
See https://gist.github.com/juhp/8cf70c3e00509347ff5e5f4bbfad74c5 for the full --verbose output
Highlighting a few points:
- attoparsec-0.14.4
appears twice (probably once for attoparsec and once for attoparsec-internal?)--dependency=attoparsec=attoparsec-0.14.4-GAKm7J8Gleq2k06HFjeIeY-attoparsec-internal
(attoparsec:attoparsec-internal gets mapped to the same pkgid)Stack version
2.15.7 and 3.1.1
Method of installation
Fedora Linux and local build
Platform
Fedora Linux
Misc
I am using a workaround: adding
os-string-2.0.6
to my project stack.yaml files (the version of os-string in lts < 22.42)The text was updated successfully, but these errors were encountered: