-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
generic-haskell-builder: Overridden Cabal package to be used by Setup.hs is ignored #43849
Comments
Why is this important / how does this issue affect us? Because in I do this on all Haskell executables. For many of them, it complains:
because even though I have explicitly told nix to use my version of Cabal, GHC eventually does not link that version in. |
I don't see how the generic builder could detect this case. The problem is that you have both versions of Cabal in scope, so Cabal is free to choose which version of the library it's going to use. The outcome is not what you intended it to be, but it's a perfectly legitimate outcome according to the rules. First of all, you really need to use If you want to be absolutely sure, then you could probably pass an appropriate Alternatively, passing P.S.: Instead of
it's easier to write:
|
I'm a bit confused by this statement, as Cabal is not involved choosing versions. We compile
No, it has exactly the same version, it has a few patches cherry-picked.
Ah thanks, that's great to know.
I'm not convinced of that; the feedback on https://ghc.haskell.org/trac/ghc/ticket/15425 suggests that GHC should really complain about it.
If there's no trick we can use to protect the user against such mistakes, we may have to wait until the linked GHC issue implements it to be an error. |
@peti This is a great idea, I didn't know about It looks like just the tool I want which could simplify what I'm doing. But I found this tangential issue: For 1 package ( See nh2/static-haskell-nix@52416d2 Do you understand what's going on there? This is currently stopping me from using |
Oh, you are right, of course. I misunderstood the problem. I thought about a Setup-driven build where there are multiple versions of a package and then |
That @kirelagin + @matthewbauer work of separating the compiler from core libraries should solve this by ensuring there really is only one Cabal visible. |
Yes, this is pretty similar to #42069, but, I think, in this specific case there is really nothing that could help. Overriding a dependency version for a single Haskell package is pretty much impossible in the current implementation of Haskell infra, what you should do is override it globally in your entire package set. The reason is simply that all transitive dependencies get unconditionally propagated into the pkgdb, so, e.g. if you are trying to override some package with an older version and one of your dependencies depends on a more recent version, you’ll end up having two config files for the same package in your pkgdb and the newer version will always win. Dependency propagation logic should really be Haskell-specific instead of relying on default |
I'm not quite sure what the specific issue here is you are referring too? a) it seems the only issue is wired-in package weirdness; there is no intentional mixing of Cabal versions b) setup dependencies are not propagated. |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
Issue description
I found a subtle issue with the generic Haskell builder that can make things confusing and the wrong
Cabal
version to be chosen.Let's say you have an overridden version of the
Cabal
library and (this is an extract from here) a function to use that for a package:Then you use
You would expect
hsyslog
'sSetup
file to be linked against the version of Cabal you specified.However, that is not the case.
It gets linked against the GHC-builtin Cabal in the "global package database".
This is because a dependency of
hsyslog
,cabal-doctest
, was not built against the custom cabal version.hsyslog
usescabal-doctest
in itsSetup.hs
file.(Note in newer versions of
hsyslog
this is not the case any more but the issue in general remains for many other packages that have customSetup.hs
files.)The generic builder builds the
Setup
executable fromSetup.hs
by directly invokingghc
:nixpkgs/pkgs/development/haskell-modules/generic-builder.nix
Line 330 in e7e5aaa
For my
useFixedCabal super.hsyslog
, this passes a-package-db=...
that contains the overriddenCabal
. But GHC will see both the builtin Cabal and the one in the given package DB, see thatcabal-doctest
was built against the non-overridden one, and silently choose the non-overridden one forhsyslog
too.There is no warning, see ticket https://ghc.haskell.org/trac/ghc/ticket/15425 which I filed for the GHC side.
What can we do about it?
A workaround is:
but for coming up with this this you really need to know the dependencies of all packages so it isn't really feasible.
Ideally, the generic Haskell builder would refuse to build / fail loudly when the Cabal versions passed for packages in dependency chains like
hsyslog
andcabal-doctest
are not the same.CC @peti
The text was updated successfully, but these errors were encountered: