You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gracefully handling old versions of base with new versions of GHC where base is reinstallable #11356
As of #10982, we now support reinstalling more packages like base when using GHC-9.14. This leads to issues since historical versions of base were released without dependency bounds.
Reproduction instructions
This means that if a package doesn't support GHC-9.14's base, then it will instead pick a very old version of base and fail with:
Error:
Dependency on unbuildable library from ghc-bignum
In the stanza 'library'
In the package 'base-4.19.2.0'
One possibility to fix this is to revise old versions of base with something like:
if impl(ghc >= 9.14):
build-depends: ghc-prim<0
This approach carries some risk. There are a lot of versions of base so the risk of making a mistake is high. We also want to make sure that we don't accidentally make some of these unusable with old versions of cabal.
Perhaps we should implement the fix in cabal. For instance we could avoid picking a version of base which is using the -this-unit-id hack.
We were wondering if you all had an opinion about what the best approach to be. I'm happy to implement something if we come up with a plan.
I had proposed that this be partially handled by ghc (a list of non-reinstallable libraries, and optionally a list of dependencies such that cabal can lock dependencies of ghc only when it's in the build plan), but this requires ghcup or etc. retrofitting such into older ghc versions. Otherwise, I don't really see a good way to deal with this.
I'm not sure how that would help here, since we do want to reinstall base and treat it like other libraries. It's just that like other libraries it can have missing bounds on Hackage, which make cabal pick bad plans.
Note that this is a new GHC trying to build an old base rather than the an old GHC trying to build a new base. We successfully avoid that combination with the way #10982 is implemented.
changed the title [-]Gracefully handling old versions of base[/-][+]Gracefully handling old versions of base with new versions of GHC where base is reinstallable[/+]on Dec 16, 2025
I thought about this a bit more and I think rts < 1.0.3 should work. GHC-9.14 will ship with rts-1.0.3 and is the first version of GHC to do so. The rts package is also not published to Hackage so there's no chance that cabal will try to pick a different version from there. It's not a problem if we start publishing it in the future so long as we don't publish old versions.
I thought about this a bit more and I think rts < 1.0.3 should work. GHC-9.14 will ship with rts-1.0.3 and is the first version of GHC to do so. The rts package is also not published to Hackage so there's no chance that cabal will try to pick a different version from there. It's not a problem if we start publishing it in the future so long as we don't publish old versions.
The problem with this approach is that if a package has tight upper bound on base, Cabal solver will fail complaining not about this, but about rts. This would be a big regression in the quality of solver errors.
Please implement a proper solution on Cabal side, marking only some versions of base as reinstallable. Solver should suggest users to relax bounds on base, not bounds of base itself on rts or ghc-internal (which would be super confusing). If this proves challenging in the timeline towards Cabal 3.18, please consider marking base non-reinstallable for time being.
I consider this issue a blocker. Cabal solver is already a source of hard to parse (and act) errors, but this brings it to another level.
I thought about this a bit more and I think we can resolve this pretty easily by adding back a constraint just for base that ensures that it is >=4.22 if we are taking the reinstallable code path.
As you can see from the test, the error message now gives a similarly helpful message to before.
Initially I had discounted this possibility since I thought that mentioning specific packages and versions would be too ad hoc, but perhaps it's better than the alternative.
Activity
geekosaur commentedon Dec 16, 2025
I had proposed that this be partially handled by ghc (a list of non-reinstallable libraries, and optionally a list of dependencies such that cabal can lock dependencies of
ghconly when it's in the build plan), but this requires ghcup or etc. retrofitting such into older ghc versions. Otherwise, I don't really see a good way to deal with this.TeofilC commentedon Dec 16, 2025
I'm not sure how that would help here, since we do want to reinstall
baseand treat it like other libraries. It's just that like other libraries it can have missing bounds on Hackage, which makecabalpick bad plans.Note that this is a new GHC trying to build an old
baserather than the an old GHC trying to build a newbase. We successfully avoid that combination with the way #10982 is implemented.[-]Gracefully handling old versions of base[/-][+]Gracefully handling old versions of base with new versions of GHC where base is reinstallable[/+]Bodigrim commentedon Dec 16, 2025
This does not seem to be a valid revision, Hackage Server says "Cannot change the 'if' condition expressions". See https://github.com/haskell/hackage-server/blob/350fd8aac61c76481fcccfeee499ab6675171320/src/Distribution/Server/Util/CabalRevisions.hs#L434-L452
TeofilC commentedon Dec 17, 2025
I thought about this a bit more and I think
rts < 1.0.3should work. GHC-9.14 will ship withrts-1.0.3and is the first version of GHC to do so. The rts package is also not published to Hackage so there's no chance that cabal will try to pick a different version from there. It's not a problem if we start publishing it in the future so long as we don't publish old versions.mpickering commentedon Feb 2, 2026
@TeofilC Have you managed to make these revisions to the historic versions?
TeofilC commentedon Feb 2, 2026
Not yet. I need someone to give me the permission on Hackage to do so
8 remaining items
ffaf1 commentedon Jun 18, 2026
I am contacting GHC people on Matrix.
If that fails, I will check with Trustees.
ffaf1 commentedon Jun 19, 2026
Zubin will push revisions according to this.
Bodigrim commentedon Jun 28, 2026
The problem with this approach is that if a package has tight upper bound on
base, Cabal solver will fail complaining not about this, but aboutrts. This would be a big regression in the quality of solver errors.Please implement a proper solution on Cabal side, marking only some versions of
baseas reinstallable. Solver should suggest users to relax bounds onbase, not bounds ofbaseitself onrtsorghc-internal(which would be super confusing). If this proves challenging in the timeline towards Cabal 3.18, please consider markingbasenon-reinstallable for time being.I consider this issue a blocker. Cabal solver is already a source of hard to parse (and act) errors, but this brings it to another level.
TeofilC commentedon Jun 28, 2026
That sounds reasonable to me. I think #11983 already implements this suggestion
TeofilC commentedon Jun 28, 2026
Ah I missed your comment apologies!
TeofilC commentedon Jun 28, 2026
I'm happy to put this behind a flag that is off by default. It's already disabled for any version of GHC<9.14
Bodigrim commentedon Jun 28, 2026
@TeofilC switching it off by default would help, I think.
cabal-install: base <4.22 is still non-reinstallable
TeofilC commentedon Jun 28, 2026
I thought about this a bit more and I think we can resolve this pretty easily by adding back a constraint just for base that ensures that it is >=4.22 if we are taking the reinstallable code path.
As you can see from the test, the error message now gives a similarly helpful message to before.
Initially I had discounted this possibility since I thought that mentioning specific packages and versions would be too ad hoc, but perhaps it's better than the alternative.
See: #12055
cabal-install: base <4.22 is still non-reinstallable
cabal-install: base <4.22 is still non-reinstallable
cabal-install: base <4.22 is still non-reinstallable
cabal-install: base <4.22 is still non-reinstallable