Repository navigation
Description
New report (edited by @ezyang)
Cabal 1.23 and later #2731 allow you to skip specifying dependencies which are not part of a buildable component. cabal-install was updated to take advantage of this fact.
However, when a package has a Custom setup script, it is possible for the Setup script to be built against an old version of Cabal, which is doesn't know to ignore non-buildable dependencies. In this case, cabal-install will pass an insufficient set of dependencies, resulting in an error like this:
setup: At least the following dependencies are missing:
process -any, temporary >=1.1
(where these are dependencies of non-buildable components.)
A workaround is to explicitly request that all components be built. For example, if there is some flag which must be selected to make a component buildable, you should pass --constraint="package-name +flagname"
Original bug report:
Trying to build pandoc-citeproc (which has a custom Setup.hs with a couple of hooks) using the latest-packaged version from git in the HVR repository (Version: 1.23+git20160204.0.7aab356~wily) fails to find dependencies already installed in a sandbox (whether the dependencies are installed manually or via the dependency solver).
$ uname -a
Linux <hostname> 4.2.0-30-generic #35-Ubuntu SMP Fri Feb 19 13:52:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3
$ cabal --version
cabal-install version 1.23.0.0
compiled using version 1.23.1.0 of the Cabal library
$ cabal sandbox init
$ cabal install pandoc-citeproc
Configuring pandoc-citeproc-0.9...
setup: At least the following dependencies are missing:
process -any, temporary >=1.1
$ cabal sandbox hc-pkg list process
process-1.2.3.0
$ cabal sandbox hc-pkg list temporary
temporary-1.2.0.4
This was previously filed as jgm/pandoc-citeproc#216
Activity
23Skidoo commentedon Feb 29, 2016
Thanks, will take a look.
Probably fallout fromsetup-dependswork.sebright commentedon Mar 1, 2016
I think I see the problem. #2731 (merged in #3039) prevented cabal from requiring the dependencies of components that are not "Buildable".
pandoc-citeprochas an executable,test-citeproc, that is enabled with the flagtest_citeprocand depends ontemporaryandprocess. When cabal-1.23 solved for the dependencies, it chose-test_citeprocand didn't pass--dependency=temporary=...toSetup. SinceSetupwas built withCabal < 1.23,Setupstill required the dependencies of the non-buildable component and failed.I don't see an easy way to fix it before the release, besides reverting the cabal-install part of #2731.
23Skidoo commentedon Mar 1, 2016
@GrayJay Thanks for the analysis. I think that the ultimate solution is to ensure that such a situation never happens and just always build setup scripts against the same version of
Cabalthatcabal-installwas built with. The fact that a version mismatch can happen has been a never-ending source of bugs (see e.g. #3138).For the 1.24 release, maybe we can do something similar to the
filterConfigureFlagsapproach and switch to the old solver behaviour when theCabalversion is too old?sebright commentedon Mar 2, 2016
@23Skidoo I thought
custom-setupallowscabal installto choose any versions of the library that are needed to build setup scripts, so we don't know what versions will be used until after solving. The backwards-compatible behavior would also need to be in the solver, since it involves choosing more dependencies. We could do something like first running the solver with a constraint on Cabal, and then solving without the constraint but with backwards-compatible behavior if the first run fails. Or we could decide package by package in the solver, maybe by adding a flag to each package with acustom-setup, but that seems like too much complexity.Is there any way to make Setup completely ignore dependencies? As far as I can tell,
--exact-configurationonly allows ignoring the version bounds.23Skidoo commentedon Mar 2, 2016
One other thing we can do is pass
--constraintinstead of--exact-configurationto setup scripts built with Cabal versions that don't support ignoring non-buildable components. This is probably the simplest solution.@GrayJay Yes,
setup-dependswith an upper bound on Cabal version present a problem. We may want to ban upper version bounds on Cabal, like we do for thecabal-versionfield (but allow them in post-release updates).sebright commentedon Mar 2, 2016
@23Skidoo How can we use
--constraintto ignore the dependencies?23Skidoo commentedon Mar 2, 2016
@GrayJay Before
--exact-configurationwas implemented, we used to feed solver output toSetup configureusing the--constraintoptions:--constraint=foo-$VER_FOO --constraint=bar-$VER_BAR [...]. So I think that if we use that old interface, but only pass the constraints for dependencies of buildable components,Setup configurewill be able to figure out what to do using its own solver.sebright commentedon Mar 2, 2016
@23Skidoo I just tried configuring the package from the "Buildable" package test, and it didn't work:
I think
--constraintonly adds to the constraints in the .cabal file.23Skidoo commentedon Mar 2, 2016
Well, that's a pity.
49 remaining items
Add a test for haskell#3199.
Force Cabal >= 1.24 dep when there's no custom-setup stanza.
Add a test for haskell#3199.
Force Cabal >= 1.24 dep when there's no custom-setup stanza.
Add a test for haskell#3199.
Add a test for haskell#3199.
Force Cabal >= 1.24 dep when there's no custom-setup stanza.
Add a test for haskell#3199.
Force Cabal >= 1.24 dep when there's no custom-setup stanza.
Add a test for haskell#3199.
Remove sandboxes part 1
Remove sandboxes part 1
Remove sandboxes.