Skip to content

cabal-install should warn if using a version of ghc that is newer than it knows about #415

Closed

Description

@bos

(updated description by @hvr)

Extended problem statement

As it's difficult to predict the future and lib:Cabal encodes knowledge about compiler internals and features indexed by their respective versions, the implicit assumption has been that the lib:Cabal version that interacts with a specific GHC version needs to be sufficiently recent. This ought to be made more explicit to avoid subtle corruption as a result of using lib:Cabal versions which aren't compatible with a given GHC release, and may either fail loudly or silently resulting in a bad user experience.

The related forward-compat scheme described in #4899 covers the compatibility aspect between Cabal and .cabal files, and encodes the principle that we don't try to understand unknown/future formats; this ticket's scope covers the Cabal / GHC interface in a similar spirit, insofar as we avoid trying to interact with unknown/future GHCs to the extent this is practicable.

To restate the basic principle of the compatibility contract

  • A component (e.g. cabal-install or lib:Cabal) can (at best) only advertise support for major versions of its downstream dependencies (e.g. lib:Cabal or ghc) or formats (e.g. .cabal spec) that were known and tested with at time of publication; we don't attempt to predict the future beyond the major version boundary

GHC version / lib:Cabal version Compatibility Matrix

To complement lib:Cabal warning about unknown GHC versions, and to avoid running into unsupported configurations we encode the compatiblity matrix as lower bounds on the lib:Cabal which interacts with GHC, and inject these as constraints to the solver.

The table below effectively encodes the respective major Cabal version bundled with the respective GHC release.

Compiler Implied constraint
GHC 8.4 Cabal >= 2.2
GHC 8.2 Cabal >= 2.0
GHC 8.0 Cabal >= 1.24
GHC 7.10 Cabal >= 1.22
any Cabal >= 1.20 && < x.(y+1) (1)

(1) base-line requirement of nix-style local builds; x.y denotes major version of cabal-install, i.e. cabal-install only knows how to interact with lib:Cabal versions it knows about


(original imported description)

(Imported from Trac #422, reported by @dcoutts on 2008-12-01)

It seems to often happen that newer versions of ghc make changes that break old versions of Cabal. This is particularly a problem for cabal-install since that need not necessarily be upgraded when ghc is upgraded.

Probably it should warn if the major version is bigger than the known version at the time.


Activity

  1. tibbe commented on May 15, 2014

    @tibbe
    Contributor

    Closing as there's been no activity in years.

    We're cleaning up the bug tracker to make it useful again and are thus closing bugs that haven't seen any activity in a long time. Please re-open (or file a new bug) if the problem reappears.

  2. reopened this on Jul 17, 2017
  3. phadej commented on Jul 17, 2017

    @phadej
    Collaborator

    Let's reopen this, people use CABALVER=1.24 GHCVER=8.2.1 in CI, and it works by accident. I don't think this is hard issue to fix, if someone (maybe new contributor) picks this up!

  4. changed the title [-]Cabal should warn if using a version of ghc that is newer than Cabal knows about[/-] [+]cabal-install should warn if using a version of ghc that is newer than it knows about[/+] on Jul 17, 2017
  5. ezyang commented on Jul 20, 2017

    @ezyang
    Contributor

    Hey @phadej, I'd like the newcomer tag to refer to tickets which have instructions for how to get started (e.g., where to look in the codebase, etc.) Maybe you could fill those out and then retag this one?

  6. 1 remaining item

  7. added 3 commits that reference this issue on Mar 3, 2018
  8. added 4 commits that reference this issue on Mar 5, 2018
  9. added a commit that references this issue on Mar 9, 2018
  10. jneira commented on Jun 29, 2022

    @jneira
    Member

    hi, from the commits and prs linking this issue I would say it can be closed (specially for #5194 which added just what was requested originally in the issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions