Skip to content
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

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

Closed
bos opened this issue May 24, 2012 · 4 comments

Comments

@bos
Copy link
Contributor

bos commented May 24, 2012

(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.


@tibbe
Copy link
Member

tibbe commented May 15, 2014

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.

@tibbe tibbe closed this as completed May 15, 2014
@phadej phadej reopened this Jul 17, 2017
@phadej
Copy link
Collaborator

phadej commented Jul 17, 2017

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!

@phadej phadej 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 Jul 17, 2017
@ezyang
Copy link
Contributor

ezyang commented Jul 20, 2017

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?

hvr added a commit to hvr/cabal that referenced this issue Feb 23, 2018
This finally addresses the long-standing ticket haskell#415
hvr added a commit that referenced this issue Feb 23, 2018
hvr added a commit to hvr/cabal that referenced this issue Feb 24, 2018
This injects lower-bound constraints on Cabal for custom setup
dependencies to prevent the solver from selecting unsupported
configurations.

Previously we already added an absolute lower bound `Cabal >= 1.20`
for nix-local builds, as that's the minimum version we need to be able
to interact with custom Setup.hs scripts. This refines with logic by
restricting that lower bound even more based on GHC version.

This patch augments this with the following rules:

- GHC 8.4+   constrains  Cabal >= 2.2
- GHC 8.2    constrains  Cabal >= 2.0
- GHC 8.0    constrains  Cabal >= 1.24
- GHC 7.10   constrains  Cabal >= 1.22
- (default   constraint  Cabal >= 1.20)

This only affects nix-style local builds codepaths.
hvr added a commit to hvr/cabal that referenced this issue Feb 28, 2018
This injects lower-bound constraints on Cabal for custom setup
dependencies to prevent the solver from selecting unsupported
configurations.

Previously we already added an absolute lower bound `Cabal >= 1.20`
for nix-local builds, as that's the minimum version we need to be able
to interact with custom Setup.hs scripts. This refines with logic by
restricting that lower bound even more based on GHC version.

This patch augments this with the following rules:

- GHC 8.4+   constrains  Cabal >= 2.2
- GHC 8.2    constrains  Cabal >= 2.0
- GHC 8.0    constrains  Cabal >= 1.24
- GHC 7.10   constrains  Cabal >= 1.22
- (default   constraint  Cabal >= 1.20)

This only affects nix-style local builds codepaths.

(cherry picked from commit 71e797e)
hvr added a commit that referenced this issue Feb 28, 2018
Implement ghc/cabal compatiblity matrix (#415)

(backported #5165)
hvr added a commit to hvr/cabal that referenced this issue Mar 3, 2018
As we can't predict the future, we also place a global upper
bound on the lib:Cabal version we know how to interact with:

The upper bound is computed by incrementing the current major
version twice in order to allow for the current version, as
well as the next adjacent major version (one of which will not
be released, as only "even major" versions of Cabal are
released to Hackage or bundled with proper GHC releases).

For instance, if the current version of cabal-install is an odd
development version, e.g.  Cabal-2.1.0.0, then we impose an
upper bound `setup.Cabal < 2.3`; if `cabal-install` is on a
stable/release even version, e.g. Cabal-2.2.1.0, the upper
bound is `setup.Cabal < 2.4`. This gives us enough flexibility
when dealing with development snapshots of Cabal and cabal-install.

This addresses haskell#415
hvr added a commit that referenced this issue Mar 3, 2018
hvr added a commit to hvr/cabal that referenced this issue Mar 3, 2018
As we can't predict the future, we also place a global upper
bound on the lib:Cabal version we know how to interact with:

The upper bound is computed by incrementing the current major
version twice in order to allow for the current version, as
well as the next adjacent major version (one of which will not
be released, as only "even major" versions of Cabal are
released to Hackage or bundled with proper GHC releases).

For instance, if the current version of cabal-install is an odd
development version, e.g.  Cabal-2.1.0.0, then we impose an
upper bound `setup.Cabal < 2.3`; if `cabal-install` is on a
stable/release even version, e.g. Cabal-2.2.1.0, the upper
bound is `setup.Cabal < 2.4`. This gives us enough flexibility
when dealing with development snapshots of Cabal and cabal-install.

This addresses haskell#415

(cherry picked from commit e66106c)
hvr added a commit that referenced this issue Mar 4, 2018
Last part of addressing #415 (fwd-ported)
grayjay added a commit to grayjay/cabal that referenced this issue Mar 5, 2018
grayjay added a commit to grayjay/cabal that referenced this issue Mar 5, 2018
grayjay added a commit that referenced this issue Mar 8, 2018
Update regression test for issue #4154 after the fix for issue #415.
grayjay added a commit to grayjay/cabal that referenced this issue Mar 8, 2018
…askell#415.

This commit addresses the comments in PR haskell#5183.

(cherry picked from commit 2b197f8)
hvr added a commit to hvr/cabal that referenced this issue Mar 8, 2018
This finally addresses the long-standing ticket haskell#415

(cherry picked from commit 5339b36)
hvr added a commit to hvr/cabal that referenced this issue Mar 8, 2018
This finally addresses the long-standing ticket haskell#415

(cherry picked from commit 5339b36)
grayjay added a commit that referenced this issue Mar 9, 2018
Update regression test for issue #4154 after the fix for issue #415. (2.2)
hvr added a commit that referenced this issue Aug 1, 2018
hvr added a commit that referenced this issue Aug 31, 2019
@jneira
Copy link
Member

jneira commented Jun 29, 2022

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
Projects
None yet
Development

No branches or pull requests

5 participants