You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal configure && cabal build of Cabal fails with corrupt package config file with top-level Cabal-1.20.0.2/3 #2114
[ezyang@hs01 Cabal]$ cabal configure
Resolving dependencies...
(snip)
[ezyang@hs01 Cabal]$ cabal build
Saved package config file seems to be corrupt. Configuring with default flags.
If this fails, please run configure manually.
This seems to be related to Cabal's bootstrapping process, since if you run dist/setup/setup build it works fine.
changed the title [-]cabal configure && cabal build with Cabal-1.20.0.2/3[/-][+]cabal configure && cabal build of Cabal fails with corrupt package config file with top-level Cabal-1.20.0.2/3[/+]on Sep 18, 2014
It always happens (so the "re-configure" doesn't help.)
[ezyang@hs01 Cabal]$ cabal build
Saved package config file seems to be corrupt. Configuring with default flags.
If this fails, please run configure manually.
Resolving dependencies...
Configuring Cabal-1.21.1.0...
Building Cabal-1.21.1.0...
Preprocessing library Cabal-1.21.1.0...
In-place registering Cabal-1.21.1.0...
[ezyang@hs01 Cabal]$ cabal build
Saved package config file seems to be corrupt. Configuring with default flags.
If this fails, please run configure manually.
Resolving dependencies...
Configuring Cabal-1.21.1.0...
Building Cabal-1.21.1.0...
Preprocessing library Cabal-1.21.1.0...
In-place registering Cabal-1.21.1.0...
I think what happens here is that cabal build tries to read dist/setup-config and fails because that file was generated by a newer version of Cabal (the one dist/setup/setup was compiled with).
Can we ditch the bootstrapping process? Is it really necessary? I feel like these days Cabal is going to be fairly conservative about what features it assumes.
OK, and this is why Travis builds with GHC 7.8.3 are failing, because Travis keeps on having to rebuild Cabal every time it runs any command.
What's interesting is that this does NOT happen with Cabal-1.18. Regression, or maybe someone implemented a feature to make bootstrapping actually work?
Actually, thinking about this more, the binary build config triggers a reconfigure every time, but that wouldn't trigger a rebuild on its own. Something else must be causing a total rebuild every time the package is reconfigured.
Actually, it's very simple to explain: when you configure, you have to build a bootstrapping copy of Cabal. This copy is not reused if you reconfigure, so it gets rebuilt every time.
This is still happening for me with cabal-install-1.23 and Cabal-1.23 from hvr's PPA whenever I do a cabal configure followed by a cabal build of certain libraries with a Custom build type. I can replicate this with @ekmett's gc repo pretty easily, since the library has no dependencies:
$ cabal get gc
Downloading gc-0...
Unpacking to gc-0/
$ cd gc-0/
$ /opt/cabal/1.24/bin/cabal configure --with-ghc /opt/ghc/8.0.1/bin/ghc
Resolving dependencies...
[1 of 1] Compiling Main ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring gc-0...
$ /opt/cabal/1.24/bin/cabal build
Saved package config file seems to be corrupt. Configuring with default flags.
If this fails, please run configure manually.
Resolving dependencies...
Configuring gc-0...
Building gc-0...
Preprocessing library gc-0...
[1 of 1] Compiling System.Mem.Manager ( src/System/Mem/Manager.hs, dist/build/System/Mem/Manager.o )
$ /opt/cabal/1.24/bin/cabal --version
cabal-install version 1.23.0.0
compiled using version 1.23.0.0 of the Cabal library
I believe that the problem is that the Cabal library shipped with GHC 8.0, and the Cabal library that hvr's PPA built with have incompatible LocalBuildInfo formats, but the same version number (since it's the 1.23.0.0 development series.) There's not much we can do here, and the problem should go away when we make proper releases and stop doing snapshots. At least, this is why the problem is happening on my system.
"cabal install cabal-install -w ghc-8.0" (In my experience, this will pick out the user-installed Cabal even if they have the same version, but if it does not then your bug will not be fixed)
Try again
It would also be useful for me to confirm if you can tell me PRECISELY what package you have installed from hvr's PPA.
@hvr, do you have any ideas how to fix the PPA so we don't have any version drift like this on RCs?
Sorry for being vague: I am using GHC 8.0.1 (version 8.0.0.20160111+git.0.497454f-10~vivid, built on 2016-01-11) and cabal-install-1.24 (version 1.23+git20160113.0.ccd618e~vivid, built on 2016-01-14) from the PPA. (I also tried cabal-install-head, version 1.23+git20160113.0.ccd618e~vivid, built on 2016-01-13, and experienced the same issue with GHC 8.0.1).
OK, I guess there's not much Cabal can do (because multiple versions of Cabal with the same version number are... not supposed to happen), but maybe we can adopt some sort of better release management practices (e.g. after GHC 8.0.1 was released, we should have immediately bumped the version number) so I'll leave this open for now.
maybe we can adopt some sort of better release management practices (e.g. after GHC 8.0.1 was released, we should have immediately bumped the version number)
I think it would minimize everyone's pain if we commit ourselves to bumping (at least) the patch level whenever the LocalBuildInfo format changes. Yes, we might end up with Cabal-1.25.0.134 in some development branch, but who really cares?
I'm OK with this, but I'd prefer it if we could figure out how to get Travis to bleat if you change any of the binary formats. Here's a proposal:
For every data structure which has a binary format which is shared across the Cabal/cabal-install boundary, we keep checked in a binary serialized version of it based on some sentinel value (it could be mempty, or it could be a custom value we write for each of them.)
We add a script to re-generate these binary serialized versions and admonishes you to bump the version.
Travis checks if this binary serialized version has changed (similar to the current misc script for checking if other-files is correct.)
FWIW, we should NOT bump the patch level, this is a BC-incompatible change so we should bump the appropriate number.
bumping some part of the dev-branch version sounds good to me, that would also help in other scenarios when using multiple dev-branch snapshot builds...
FWIW, we should NOT bump the patch level, this is a BC-incompatible change so we should bump the appropriate number.
If we're going to follow the PVP, we would bump the major version, i.e. 1.25 -> 1.27 every time one of the types changes. I don't think we need to follow the PVP for development versions as long as we document what we are doing. I was going to suggest we bump patch (1.25.0.0 -> 1.25.0.1) for internal changes and minor (1.25.0.1 -> 1.25.1.0) for release candidates, since that's the problem here. Note that our development versions already ignore the PVP, so transitioning to a documented system that still ignores the PVP is a net gain and not a regression.
Also note: bumping the version forces a rebuild of EVERYTHING. So we don't want to do it too frequently.
I'm not sure what everything we're talking about. For a development version of Cabal, that should just trigger a rebuild of Cabal and cabal-install, but that doesn't seem like a big deal to me. Could you clarify?
That's what I mean. It is modestly annoying to rebuild all of Cabal (12min) so I avoid it when I can. But you are right, it is not such a big deal. (It would be a big deal if you had to do it every edit or commit.)
That's what I mean. It is modestly annoying to rebuild all of Cabal (12min) so I avoid it when I can. But you are right, it is not such a big deal. (It would be a big deal if you had to do it every edit or commit.)
Oh yes, I see what you mean. I really just mean changing the version every time a binary-incompatible change gets merged back into master.
Activity
[-]cabal configure && cabal build with Cabal-1.20.0.2/3[/-][+]cabal configure && cabal build of Cabal fails with corrupt package config file with top-level Cabal-1.20.0.2/3[/+]23Skidoo commentedon Sep 18, 2014
Does this happen every time or just once?
ezyang commentedon Sep 18, 2014
It always happens (so the "re-configure" doesn't help.)
23Skidoo commentedon Sep 18, 2014
I think what happens here is that
cabal buildtries to readdist/setup-configand fails because that file was generated by a newer version of Cabal (the onedist/setup/setupwas compiled with).ezyang commentedon Sep 18, 2014
Can we ditch the bootstrapping process? Is it really necessary? I feel like these days Cabal is going to be fairly conservative about what features it assumes.
ttuegel commentedon Sep 18, 2014
Yeah, I think
cabal buildcan't read the new binarydist/setup-config. It should work if you rebuild cabal-install against a new Cabal.ezyang commentedon Sep 18, 2014
OK, and this is why Travis builds with GHC 7.8.3 are failing, because Travis keeps on having to rebuild Cabal every time it runs any command.
What's interesting is that this does NOT happen with Cabal-1.18. Regression, or maybe someone implemented a feature to make bootstrapping actually work?
ezyang commentedon Sep 18, 2014
OK, I also figured out why Travis thinks Cabal head is passing: some build machines are faster than others, so sometimes it finishes in the time limit. Example comparison: https://travis-ci.org/haskell/cabal/jobs/35653681 versus https://travis-ci.org/haskell/cabal/jobs/35345009
Merge pull request #2038 from ezyang/ezyang-renaming
23Skidoo commentedon Sep 19, 2014
Not good!
ttuegel commentedon Sep 19, 2014
Actually, thinking about this more, the binary build config triggers a reconfigure every time, but that wouldn't trigger a rebuild on its own. Something else must be causing a total rebuild every time the package is reconfigured.
ezyang commentedon Sep 19, 2014
Actually, it's very simple to explain: when you configure, you have to build a bootstrapping copy of Cabal. This copy is not reused if you reconfigure, so it gets rebuilt every time.
ttuegel commentedon Sep 19, 2014
In the logs you linked, it's not the bootstrapping copy that's being rebuilt.
EDIT: Sorry, my mistake, I understood a different meaning of bootstrapping.
ezyang commentedon Sep 19, 2014
Hmm, you're right! I guess I don't know then.
4 remaining items
RyanGlScott commentedon Jan 19, 2016
This is still happening for me with
cabal-install-1.23andCabal-1.23from hvr's PPA whenever I do acabal configurefollowed by acabal buildof certain libraries with aCustombuild type. I can replicate this with @ekmett'sgcrepo pretty easily, since the library has no dependencies:This issue also prevents
lensfrom building successfully on Travis with GHC 8.0.1-rc.ezyang commentedon Jan 19, 2016
Yep, I can repro.
Some more data points:
ezyang commentedon Jan 19, 2016
I believe that the problem is that the Cabal library shipped with GHC 8.0, and the Cabal library that hvr's PPA built with have incompatible
LocalBuildInfoformats, but the same version number (since it's the 1.23.0.0 development series.) There's not much we can do here, and the problem should go away when we make proper releases and stop doing snapshots. At least, this is why the problem is happening on my system.@RyanGlScott Here is a workaround for you:
It would also be useful for me to confirm if you can tell me PRECISELY what package you have installed from hvr's PPA.
@hvr, do you have any ideas how to fix the PPA so we don't have any version drift like this on RCs?
RyanGlScott commentedon Jan 19, 2016
Sorry for being vague: I am using GHC 8.0.1 (version
8.0.0.20160111+git.0.497454f-10~vivid, built on 2016-01-11) andcabal-install-1.24(version1.23+git20160113.0.ccd618e~vivid, built on 2016-01-14) from the PPA. (I also triedcabal-install-head, version1.23+git20160113.0.ccd618e~vivid, built on 2016-01-13, and experienced the same issue with GHC 8.0.1).And your workaround does, indeed, work!
ezyang commentedon Jan 19, 2016
OK, I guess there's not much Cabal can do (because multiple versions of Cabal with the same version number are... not supposed to happen), but maybe we can adopt some sort of better release management practices (e.g. after GHC 8.0.1 was released, we should have immediately bumped the version number) so I'll leave this open for now.
ttuegel commentedon Jan 19, 2016
I think it would minimize everyone's pain if we commit ourselves to bumping (at least) the patch level whenever the
LocalBuildInfoformat changes. Yes, we might end up withCabal-1.25.0.134in some development branch, but who really cares?ezyang commentedon Jan 19, 2016
I'm OK with this, but I'd prefer it if we could figure out how to get Travis to bleat if you change any of the binary formats. Here's a proposal:
mempty, or it could be a custom value we write for each of them.)miscscript for checking ifother-filesis correct.)FWIW, we should NOT bump the patch level, this is a BC-incompatible change so we should bump the appropriate number.
hvr commentedon Jan 19, 2016
bumping some part of the dev-branch version sounds good to me, that would also help in other scenarios when using multiple dev-branch snapshot builds...
ezyang commentedon Jan 19, 2016
Also note: bumping the version forces a rebuild of EVERYTHING. So we don't want to do it too frequently.
ttuegel commentedon Jan 20, 2016
If we're going to follow the PVP, we would bump the major version, i.e.
1.25 -> 1.27every time one of the types changes. I don't think we need to follow the PVP for development versions as long as we document what we are doing. I was going to suggest we bump patch (1.25.0.0 -> 1.25.0.1) for internal changes and minor (1.25.0.1 -> 1.25.1.0) for release candidates, since that's the problem here. Note that our development versions already ignore the PVP, so transitioning to a documented system that still ignores the PVP is a net gain and not a regression.I'm not sure what everything we're talking about. For a development version of Cabal, that should just trigger a rebuild of Cabal and cabal-install, but that doesn't seem like a big deal to me. Could you clarify?
ezyang commentedon Jan 20, 2016
That's what I mean. It is modestly annoying to rebuild all of Cabal (12min) so I avoid it when I can. But you are right, it is not such a big deal. (It would be a big deal if you had to do it every edit or commit.)
ttuegel commentedon Jan 20, 2016
Oh yes, I see what you mean. I really just mean changing the version every time a binary-incompatible change gets merged back into master.
23Skidoo commentedon Feb 22, 2016
Closing in favour of #3181.