-
Notifications
You must be signed in to change notification settings - Fork 240
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 build
doesn't find public sub package within development shell but builds fine with nix build.
#1662
Comments
Does this happen with source-repository-package? |
like, when I declare the dependency in a |
yeah |
but if you do it through |
Can anyone point me at where this
comes form? Maybe I can fix it if I know. |
If I put a I still works for the |
I'm thinking that something's wrong with |
I think I found the issue: 131 │ # Collect all (transitive) Haskell library dependencies of a
132 │ # component.
133 │ ## flatLibDepends :: Component -> [Package]
134 │ flatLibDepends = component:
135 │ let
136 │ makePairs = map (p: rec { key=val.name; val=(p.components.library or p); });
137 │ closure = builtins.genericClosure {
138 │ startSet = makePairs component.depends;
139 │ operator = {val,...}: makePairs val.config.depends;
140 │ };
141 │ in map ({val,...}: val) closure; this doesn't include |
Unfortunately I don't think that is it. The reason it does not have I think the problem is more likely that the way we are making package DB entries for sublibs is not what cabal expects. So it works with I think we should try to compare the the package DB entries that |
if I add the sublibs in the flatLibDepends function, the derivation gets added to buildInputs which before isn't the case ghc-pkg list includes the sublib dependency but marks it as blue. cabal also doesn't recognise the sublib. |
It also seems like its given a weird name, in case of my reproducer:
|
so the reason it does not look up the |
It seems the normal nixpkgs haskell infrastructure also can't handle sublibs. |
@hamishmack as you suggested I investigated the
|
I've done some digging too. Here are my notes (not sure how useful they are). I add a
Then I used hix to look in the
So As you pointed out the
But in a shell for the just
Letting cabal rebuild the package
Leaves us with a I'm not actually sure what mechanism And then there is this, "ghc-pkg doesn't work well with the v2 store because the v2 store basically uses a bunch of semi-documented/proprietary extensions to the package database that ghc-pkg hasn't been taught about". I worried sublibs (and probably backpack) are examples of those extensions. |
The only thing that's suspicious afaict is that the sublib is marked blue up on |
Something I was wondering, too: there's a cabal plan generated by |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still an issue. |
I started looking in this again. Just a couple of notes so far:
|
Does haskell/cabal#6039 have to be fixed first? |
It could be related but I cannot tell yet. |
Ok, I read a bunch of code and yes, that issue is defintely the problem. A bit of background first: One involves reusing packages already available in the packagedb. This is what happens when you have something that depends on a boot package (e.g.
(Note that if you force a difference version of A completely difference mechanism intervienes after the solver and it's the "store". Once the solver has made an install plan with the packages that should be compiled, cabal looks into the store and checks if any of those have already been compiled. It then it replaces packages in the plan with indentical packages already available in the store; making what gets called an improved plan. The packages that the solver wants to compile appear in So, what happens is this: the cabal solver is not aware of packages with multiple libraries, and always ends up compiling them, but the cabal store makes this unnoticeable (given that none of the boot libraries have sublibs). But haskell.nix provides a global packagedb and not a cabal store, so cabal has to do what the solver says and recompiles those packages. Note: the cabal store is implemented as packagedb, just like the global one. Nevertheless, it is used in a completely different way (i.e. it's not passed as a packagedb to the solver). Note: one should probably mention that the solver itself does not know about components at all, but only about packages. Once the solver has made a plan with all dependencies at the package level, cabal "elaborates" the plan turning it into a plan between components. I have a couple of ideas of how we can solve this in a simple way; but fixing cabal could also be a worthy endeavor. |
When trying to
cabal build
a package that contains a public sublibrary, cabal fails to find this library within a shell provided by haskell.nix.Somehow everything builds just fine with
nix build
.Reproducer fails with:
The text was updated successfully, but these errors were encountered: