Skip to content

cabal-install: base <4.22 is still non-reinstallable#12055

Merged
mergify[bot] merged 1 commit into
masterfrom
wip/better-nonreinstallable-error
Jun 30, 2026
Merged

cabal-install: base <4.22 is still non-reinstallable#12055
mergify[bot] merged 1 commit into
masterfrom
wip/better-nonreinstallable-error

Conversation

@TeofilC

@TeofilC TeofilC commented Jun 28, 2026

Copy link
Copy Markdown
Member

GHC-9.14 ships with base-4.22. Since that release of GHC, base is "reinstallable". This means that we can install a version of base that is not the one that was shipped with GHC.
In #10982, we extended cabal-install to allow reinstalling base when GHC>=9.14

Yet, we should not allow solving for very old versions of base. Older versions of base can be picked by the solver, but they are unbuildable and give confusing error messages.

We need both a version of GHC>=9.14 and a version of base>=4.22, otherwise we are forced to use the version that was shipped with GHC.

To solve this, we simply also add a constraint that base must be >=4.22 if we take it to be reinstallable. So, now the error mentions that versions of base <4.22 are non-reinstallable.

This is an unfortunate hack to resolve this error, but it's the best we can do.
Alternatively we could try to revise old versions of base so that the solver does not pick them, but then we would still get a somewhat confusing error message (old versions of base require such and such a version of the rts), and it would require that users have a version of the Hackage tarball that is latter than the revisions.

Resolves #11356

I have not added a changelog entry as this just modifies the behaviour of an unreleased feature. I think the existing changelog entry is sufficient.

Include the following checklist in your PR:

Manual QA notes

  • With GHC-9.14 try building a package which has this in its build-depends base <4.22
  • You should get an error that is a bit more helpful than before
  • Then loosen the bound to base <4.23 and rebuild
  • and it should build

@TeofilC TeofilC force-pushed the wip/better-nonreinstallable-error branch from b261f27 to 3f11c20 Compare June 28, 2026 22:35
@TeofilC TeofilC force-pushed the wip/better-nonreinstallable-error branch 2 times, most recently from 0fa56a1 to 2b8eed3 Compare June 28, 2026 22:42
GHC-9.14 ships with base-4.22, since that release of GHC, base is
"reinstallable". This means that we can install a version of base that
is not the one that was shipped with GHC.
In #10982, we extended cabal-install to allow reinstalling base when
GHC>=9.14

Yet, we should *not* allow solving for very old versions of base. Older
versions of base can be picked by the solver, but they are unbuildable
and give confusing error messages.

To solve this, we simply also add a constraint that base must be >=4.22
if we take it to be reinstallable. So, now the error mentions that
versions of base <4.22 are non-reinstallable.

This is an unfortunate hack to resolve this error, but it's the best we
can do.
Alternatively we could try to revise old versions of base so that the
solver does not pick them, but then we would still get a somewhat
confusing error message (old versions of base require such and such a
version of the rts), and it would require that users have a version of
the Hackage tarball that is latter than the revisions.

Resolves #11356
@Bodigrim

Copy link
Copy Markdown
Collaborator

I tested it manually using my example from #11983 (comment). Seems good, thanks.

@Bodigrim Bodigrim added merge me Tell Mergify Bot to merge and removed attention: needs-review labels Jun 30, 2026
@mergify mergify Bot added merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days queued labels Jun 30, 2026
@mergify

mergify Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 2 hours 2 minutes 11 seconds in the queue, including 1 hour 51 minutes 6 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Validate post job
    • check-neutral = Validate post job
    • check-skipped = Validate post job
  • any of [🛡 GitHub branch protection]:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of [🛡 GitHub branch protection]:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of [🛡 GitHub branch protection]:
    • check-success = Bootstrap post job
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
  • any of [🛡 GitHub branch protection]:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of [🛡 GitHub branch protection]:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of [🛡 GitHub branch protection]:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

mergify Bot added a commit that referenced this pull request Jun 30, 2026
@mergify mergify Bot merged commit 57e070f into master Jun 30, 2026
78 checks passed
@mergify mergify Bot deleted the wip/better-nonreinstallable-error branch June 30, 2026 21:29
@mergify mergify Bot removed the queued label Jun 30, 2026
@Bodigrim

Copy link
Copy Markdown
Collaborator

(Sorry, I didn't realise that "priority: high" has an effect of bypassing two days delay before merging; I hope it's acceptable)

@Mikolaj

Mikolaj commented Jul 3, 2026

Copy link
Copy Markdown
Member

It's fine. :)

@Mikolaj

Mikolaj commented Jul 3, 2026

Copy link
Copy Markdown
Member

@mergify backport 3.18

@mergify

mergify Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

backport 3.18

✅ Backports have been created

Details

mergify Bot added a commit that referenced this pull request Jul 3, 2026
Backport #12055: cabal-install: base <4.22 is still non-reinstallable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge priority: high 🔥

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gracefully handling old versions of base with new versions of GHC where base is reinstallable

4 participants