cabal
cabal copied to clipboard
Regression in 3.12: package system-filepath (with custom Setup) cannot be installed with GHC 8.0
With cabal-install-3.12.1.0, I can trigger this bug
- by
cabal install -w ghc-8.0.2 system-filepath-0.4.14(latest version ofsystem-filepath) - by getting
system-filepathand do acabal install --lib -w ghc-8.0.2 - or by getting package
acid-state(which depends onsystem-filepath) and then do acabal build -w ghc-8.0.2
In the wild: https://github.com/acid-state/acid-state/actions/runs/10947885622/job/30397644524?pr=170#step:17:566 Error is:
setup: Unrecognised flags: lib:system-filepath
With cabal master (3.15), I am getting different errors:
unrecognized 'configure' option `--with-doctest=/Users/abel/.cabal/bin/doctest'
unrecognized 'configure' option `--with-runghc=/usr/local/bin/runghc-8.0.2'
None of the mentioned errors occur with -w ghc-8.2.2 (or any higher GHC major version).
If I have to guess, then it is not really the GHC version that matters here but the version of the Cabal library that the Setup.hs is built with. (But I could be on the wrong track.)
- GHC 8.0 comes with Cabal-1.24
- GHC 8.2 comes with Cabal-2.0
So, was support for Cabal-1.24 (silently or by accident) dropped in cabal-install-3.12? (Couldn't find it in https://github.com/haskell/cabal/blob/982fb820991e0b29228243ad6dbee23c11adde1d/release-notes/cabal-install-3.12.1.0.md)
A parallel to such unwanted compatibility drop is
- https://github.com/commercialhaskell/stack/issues/6498
Should cabal-install explicitly refuse to work with Cabal < 2?
8.0.2 is still in the validate-old-ghcs job and seems to pass. (7.x is gone, mostly because we can't install it via ghcup; while it has 7.10.3, the installer segfaults on Ubuntu.)
There should have been an entry in the changelog about ghcs outside the support window being dropped, per https://github.com/haskell/cabal/pull/9722. But it seems @mpickering broke the rules (this requires a changelog entry) and none of us caught it during review, sorry.
8.0.2 is still in the validate-old-ghcs job and seems to pass.
But does this suite cover installing custom-setup packages with old versions of Cabal?
There should have been an entry in the changelog about ghcs outside the support window being dropped,
The lack of changelog suggests that this drop was maybe unintended. But what is more important than a changelog entry is a warning/error that cabal-install emits in such situations.
Maybe this table needs to be edited (or something in the proximity of it): https://github.com/haskell/cabal/blob/982fb820991e0b29228243ad6dbee23c11adde1d/cabal-install/src/Distribution/Client/ProjectPlanning.hs#L1390-L1403
Related is also:
- #9917
It's supposed to still be supported; this sounds like a case validate-old-ghcs isn't testing. (We don't run a full validate on them, and even if we did we may not have a test for this failure mode.)
Here is another instance when trying to build HTTP with ghc-8.0.2: https://github.com/haskell/HTTP/actions/runs/10947125731/job/30395160142#step:17:206
Failed to build entropy-0.4.1.10 (which is required by pureMD5-2.1.4). See the build log above for details. ... setup: Unrecognised flags: lib:entropy
The error
setup: Unrecognised flags: lib:entropy
suggests that the target syntax "lib:FOO" isn't understood by the generated setup.
Internal libraries entered Cabal in version 2.0:
- https://github.com/haskell/cabal/blob/d988732a2ad03b35a749af5940743cb9c9ca7035/Cabal/ChangeLog.md#2002-mikhail-glushenkov-july-2017
- #269
- #3022
So one hypothesis is that cabal-install-3.12, when calling the generated setup program, uses a new syntax for targets that became available with Cabal-2.0 together with internal libraries.
What the errors thrown by cabal master concerns,
unrecognized 'configure' option `--with-doctest=/Users/abel/.cabal/bin/doctest'
unrecognized 'configure' option `--with-runghc=/usr/local/bin/runghc-8.0.2'
I could not easily find out when these options were added.
I think these failures deserve some investigation. Adding label "regression on master".
I'm looking at our support window:
https://github.com/haskell/cabal/blob/4d298d3f5a2d0cc2c2361974faad306fa8b9d092/CONTRIBUTING.md?plain=1#L223-L224
and at the 8.0.2 release date of 11th January 2017, which is 7 years ago
https://www.haskell.org/ghc/download_ghc_8_0_2.html
and it seems this is way outside any of our windows (or CONTRIBUTING.md is incomplete).
If that's true, that suggests we have a lot of flexibility tackling this issue. Retroactively editing setupMinCabalVersionConstraint should be fine. If that doesn't improve the error message or accompany it with a good enough explanatory warning, we may try to improve the messages along the lines proposed somewhere in https://github.com/haskell/cabal/issues/9917. Or maybe https://github.com/haskell/cabal/pull/10395 improves situation here?
We may also want to remove 8.0.2 from old-ghcs CI not to confuse the users that it's fully supported and mention this in the changelog prominently (maybe even edit the old changelog, too).
Should cabal-install explicitly refuse to work with Cabal < 2?
Isn't that too brutal? Doesn't it still work fine in many scenarios?
I'm looking at our support window:
If I read this text correctly, it only talks about buildability of Cabal and cabal-install.
It does not say which versions of Cabal (and GHC) the cabal-install tool should support.
Probably this kind of support window should be defined.
The de facto sentence would read:
cabal-install-3.12officially supports building projects with GHC 8.2 and up. (It might work with older GHC versions in many cases as well.)
Retroactively editing
setupMinCabalVersionConstraintshould be fine.
This should be tried, maybe it fixes the build, or at least it point to the reason why building is not possible (fingers crossed).
See also #10012.