Skip to content

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

Description

@TeofilC

Describe the bug

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'

See also: https://gitlab.haskell.org/ghc/ghc/-/issues/26541

Expected behavior

It should fail with a better message.

Proposed solution

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.

Activity

  1. geekosaur commented on Dec 16, 2025

    @geekosaur
    Collaborator

    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.

  2. TeofilC commented on Dec 16, 2025

    @TeofilC
    MemberAuthor

    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.

  3. 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
  4. Bodigrim commented on Dec 16, 2025

    @Bodigrim
    Collaborator

    One possibility to fix this is to revise old versions of base with something like...

    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

  5. TeofilC commented on Dec 17, 2025

    @TeofilC
    MemberAuthor

    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.

  6. mpickering commented on Feb 2, 2026

    @mpickering
    Collaborator

    @TeofilC Have you managed to make these revisions to the historic versions?

  7. TeofilC commented on Feb 2, 2026

    @TeofilC
    MemberAuthor

    Have you managed to make these revisions to the historic versions?

    Not yet. I need someone to give me the permission on Hackage to do so

  8. 8 remaining items

  9. ffaf1 commented on Jun 18, 2026

    @ffaf1
    Collaborator

    I am contacting GHC people on Matrix.
    If that fails, I will check with Trustees.

  10. ffaf1 commented on Jun 19, 2026

    @ffaf1
    Collaborator

    Zubin will push revisions according to this.

  11. Bodigrim commented on Jun 28, 2026

    @Bodigrim
    Collaborator

    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.

  12. TeofilC commented on Jun 28, 2026

    @TeofilC
    MemberAuthor

    That sounds reasonable to me. I think #11983 already implements this suggestion

  13. TeofilC commented on Jun 28, 2026

    @TeofilC
    MemberAuthor

    Ah I missed your comment apologies!

  14. TeofilC commented on Jun 28, 2026

    @TeofilC
    MemberAuthor

    If this proves challenging in the timeline towards Cabal 3.18, please consider marking base non-reinstallable for time being.

    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

  15. Bodigrim commented on Jun 28, 2026

    @Bodigrim
    Collaborator

    @TeofilC switching it off by default would help, I think.

  16. added a commit that references this issue on Jun 28, 2026
    3f11c20
  17. TeofilC commented on Jun 28, 2026

    @TeofilC
    MemberAuthor

    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

  18. added 3 commits that reference this issue on Jun 28, 2026
    0fa56a1
    2b8eed3
    20f0f90
  19. added a commit that references this issue on Jul 16, 2026
    0c8510c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: high 🔥re: error-messagere: user experiencetype: discussiontype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions