Repository navigation
Closed
Description
Here's what happens if you have binary-0.8 installed (this was with GHC 7.10.3):
$ cabal install Cabal
Resolving dependencies...
[ 1 of 79] Compiling Distribution.GetOpt ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/GetOpt.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/GetOpt.o )
[ 2 of 79] Compiling Distribution.Compat.Binary ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Compat/Binary.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Compat/Binary.o )
[ 3 of 79] Compiling Distribution.TestSuite ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/TestSuite.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/TestSuite.o )
[ 4 of 79] Compiling Distribution.Simple.PreProcess.Unlit ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Simple/PreProcess/Unlit.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Simple/PreProcess/Unlit.o )
[ 5 of 79] Compiling Distribution.Simple.CCompiler ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Simple/CCompiler.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Simple/CCompiler.o )
[ 6 of 79] Compiling Distribution.PackageDescription.Utils ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/PackageDescription/Utils.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/PackageDescription/Utils.o )
[ 7 of 79] Compiling Distribution.Compat.ReadP ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Compat/ReadP.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Compat/ReadP.o )
[ 8 of 79] Compiling Distribution.ReadE ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/ReadE.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/ReadE.o )
[ 9 of 79] Compiling Distribution.Verbosity ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Verbosity.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Verbosity.o )
[10 of 79] Compiling Distribution.Text ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Text.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Text.o )
[11 of 79] Compiling Distribution.ModuleName ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/ModuleName.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/ModuleName.o )
[12 of 79] Compiling Distribution.System ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/System.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/System.o )
[13 of 79] Compiling Distribution.Version ( /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Version.hs, /tmp/cabal-tmp-7012/Cabal-1.22.6.0/dist/setup/Distribution/Version.o )
/tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Version.hs:135:10:
Duplicate instance declarations:
instance Binary Version
-- Defined at /tmp/cabal-tmp-7012/Cabal-1.22.6.0/Distribution/Version.hs:135:10
instance [safe] Binary Version
-- Defined in ‘binary-0.8.0.0:Data.Binary.Class’
Failed to install Cabal-1.22.6.0
cabal: Error: some packages failed to install:
Cabal-1.22.6.0 failed during the configure step. The exception was:
ExitFailure 1
Activity
hvr commentedon Dec 28, 2015
Sadly, I don't know if we can fix the situation for pre-
setup-dependscabals at all... :-//cc @edsko @dcoutts
phadej commentedon Dec 28, 2015
you can install
Cabalif you docabal configure --ghc-options=-DMIN_VERSION_binary_0_8_0=1;unfortunately it's something you just have to know :(
hvr commentedon Dec 28, 2015
@phadej it's a problem though as it breaks as soon as any install-plan automatically results in an (re)installation of
Cabal... we can't expect cabal users to start manually setting CPP flags :-(hvr commentedon Dec 28, 2015
Btw, adding
custom-setupsection withsetup-dependsmirroringlibrary'sbuild-dependsdoesn't work either forCabal... so it seems we can't even fix this easily forsetup-dependsaware Cabals :-(and adding
Cabalas a dependency is a bad idea, as it sends the solver into an endless loop...phadej commentedon Dec 28, 2015
@hvr, I'm not sure if reinstallation of
Cabalis a good idea, i.e. if there is a real problem. I try to downplay this, as I just don't know if this can be solved, except by settingbinary <0.8onghc <8.0.Which OTOH might be good enough?
hvr commentedon Dec 28, 2015
With the new
custom-setupfeature, reinstallation of Cabal will happen, as this feature was added to allow us to specify which Cabal package version range aSetup.hsfile was written against (or is known to be compatible with).I hope you're right and this problem won't occur so much for users, but if it does, users will just have yet another complaint about cabal, and no amount of downplaying is gonna resolve that... :-(
At the very least, we need to find a way to make this work properly with cabal 1.24+ if we can't fix this for pre-1.24 cabal
phadej commentedon Dec 28, 2015
I'm ok, with
binary <0.8for just releaseCabalfor yet another release, if we really need
binary-0.8supporthvr commentedon Dec 28, 2015
@phadej are you sure that works?
I.e. if I do something like
I run into the very same build-failure, because version constraints don't apply to
Setup.hswhatsoever.phadej commentedon Dec 28, 2015
@hvr, what if the
if Impl ghcis added tocustom-setup? So it could work withcustom-setupawarecabaland recent enoughghc? Or is there still so corner cases?hvr commentedon Dec 28, 2015
Once you can use
custom-setup(which requiresCabal>=1.24, but this is broken for self-bootstrappingCabalanyway, currently - but I have an idea for that one...), you also get properly workingMIN_VERSION_...macros anyway. So there's no need to rejectbinary-0.8in that case :-/We would only need to reject
binary-0.8for the pre-1.24 situation where have no way yet to do so :-/phadej commentedon Dec 28, 2015
Extreme solution, would to have
Cabal'smaster(and1.24) bebinary >= 0.8; and1.22series with<0.8?phadej commentedon Dec 28, 2015
Yet, the problem will probably still exist if user has both
binary-0.7andbinary-0.8in package database, GHC will probably pick0.8forSetupcompilation?ezyang commentedon Dec 28, 2015
The analysis in this bug is incomplete.
The problem is that 1.22 and prior release of Cabal had "build-type: Custom", which causes GHC to first try to build the Setup executable with "ghc --make" (using the default database) before actually building it proper. Prior to setup dependencies, no dependencies were specified for this call, which is why binary-0.8 is automatically being picked when this occurs.
First, this should NOT be a problem with Cabal HEAD, because we have removed the self-bootstrapping behavior (build-type: Simple), so we should never attempt to build Cabal with the default package database. The normal build of Cabal will properly have version macros specified, so no problems there.
Second, hvr's setup-depends solution WILL work (if we want bootstrapping), we just need to fix the Distribution.Simple.Utils to test for the availability of Paths_Cabal differently. Right now, it assumes that the presence of a version macro means that Paths_Cabal is available; in fact, with GHC 8.0, this will no longer be the case. This should be fixed.
Third, constraints will do no good without setup-depends, so @phadej's proposed solution will not work.
If our problem is that the cabal-install dependency solver will accidentally try to build old versions of Cabal when the new DB doesn't work, then there is a simple solution: we should make emergency new releases of the old release series of Cabal with "build-type: Custom" turned off, as far as possible. Assuming cabal-install prefers the latest version and no one has set patch level constraints, it will pick a version that will compile.
One possible problem is that the self-bootstrapping behavior was necessary to build Cabal. In that case, if your cabal-install is too old and you try to install a new Cabal, it won't work.
But we know this is NOT the case for the versions of GHC we support (back to 7.4), because our Travis instance is successfully building Cabal using the default shipped Cabal (I think).Travis builds a bootstrap setup first, so this is not true.55 remaining items
23Skidoo commentedon Jan 29, 2016
OK, I think we agree that for
build-type: Simplewe should compile the setup script with-iinstead of-i -i.. It will also fully fix thebinary-0.8issue for the users of up-to-datecabal-installversions.Then if we revert the
hs-source-dirs: srcchange we'll have the following situation:build-type: Custombuild-type: Simple,hs-source-dirs: .cabal-installwithout e2bf243 and b453d30setup-1.22issetup-1.22), incompatible with binary-0.8 (without-j1)cabal-installwith e2bf243 and b453d30So we won't have to worry about cache poisoning and the "unrecognized options" error. And we can tell people running into the
binary-0.8error when upgrading to either doghc-pkg hide binary-0.8or runcabal install -j1 Cabal && cabal install cabal-install.ezyang commentedon Jan 29, 2016
Just to be totally clear, this workaround only helps for the
build-type: Simple, hs-source-dirs: .situation.Another problem with the
binary-0.8hide workaround, @hvr mentioned that some Travis buildbots get binary-0.8 installed by distro packages, in which case you can't actually hide the package easily, since it is in the global database.23Skidoo commentedon Jan 29, 2016
Yep, and given that we now have new Cabal releases with
build-type: Simple, hs-source-dirs: ., it should work for the majority of users.Only Custom setup scripts should be compiled with '-i -i.'.
Only Custom setup scripts should be compiled with '-i -i.'.
Only Custom setup scripts should be compiled with '-i -i.'.
Only Custom setup scripts should be compiled with '-i -i.'.
23Skidoo commentedon Jan 30, 2016
Reverted the
hs-source-dirs: srcchange and changedD.C.SetupWrapperto pass-i -i.to GHC only when compiling Custom setup scripts. Now we only need to cut newcabal-installreleases and then this can be marked as fixed.rthomas commentedon Jan 31, 2016
I've released cabal-install 1.22.8.0, 1.20.2.0 and 1.18.2.0, so I'll close this issue.
23Skidoo commentedon Jan 31, 2016
Thanks to everyone involved!
Move source files under 'src/'.
.travis.yml/install_from_tarball: Use '--cabal-lib-version'.
Only Custom setup scripts should be compiled with '-i -i.'.
installedCabalVersion: Don't special-case Cabal anymore.