Skip to content

cabal configure && cabal build of Cabal fails with corrupt package config file with top-level Cabal-1.20.0.2/3 #2114

Closed

Description

@ezyang

When using most recent released Cabal:

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

Activity

  1. 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
  2. 23Skidoo commented on Sep 18, 2014

    @23Skidoo
    Member

    Does this happen every time or just once?

  3. ezyang commented on Sep 18, 2014

    @ezyang
    ContributorAuthor

    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...
    
  4. 23Skidoo commented on Sep 18, 2014

    @23Skidoo
    Member

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

  5. ezyang commented on Sep 18, 2014

    @ezyang
    ContributorAuthor

    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.

  6. ttuegel commented on Sep 18, 2014

    @ttuegel
    Member

    Yeah, I think cabal build can't read the new binary dist/setup-config. It should work if you rebuild cabal-install against a new Cabal.

  7. ezyang commented on Sep 18, 2014

    @ezyang
    ContributorAuthor

    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?

  8. ezyang commented on Sep 18, 2014

    @ezyang
    ContributorAuthor

    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

  9. added a commit that references this issue on Sep 18, 2014
  10. 23Skidoo commented on Sep 19, 2014

    @23Skidoo
    Member

    Travis keeps on having to rebuild Cabal every time it runs any command

    Not good!

  11. ttuegel commented on Sep 19, 2014

    @ttuegel
    Member

    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.

  12. ezyang commented on Sep 19, 2014

    @ezyang
    ContributorAuthor

    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.

  13. ttuegel commented on Sep 19, 2014

    @ttuegel
    Member

    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.

  14. ezyang commented on Sep 19, 2014

    @ezyang
    ContributorAuthor

    Hmm, you're right! I guess I don't know then.

  15. 4 remaining items

  16. RyanGlScott commented on Jan 19, 2016

    @RyanGlScott
    Member

    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
    

    This issue also prevents lens from building successfully on Travis with GHC 8.0.1-rc.

  17. ezyang commented on Jan 19, 2016

    @ezyang
    ContributorAuthor

    Yep, I can repro.

    Some more data points:

    • It doesn't happen with GHC 7.10.
  18. ezyang commented on Jan 19, 2016

    @ezyang
    ContributorAuthor

    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.

    @RyanGlScott Here is a workaround for you:

    1. Grab a copy of HEAD Cabal
    2. "cabal install Cabal -w ghc-8.0"
    3. "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)
    4. 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?

  19. reopened this on Jan 19, 2016
  20. RyanGlScott commented on Jan 19, 2016

    @RyanGlScott
    Member

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

    And your workaround does, indeed, work!

  21. ezyang commented on Jan 19, 2016

    @ezyang
    ContributorAuthor

    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.

  22. ttuegel commented on Jan 19, 2016

    @ttuegel
    Member

    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?

  23. ezyang commented on Jan 19, 2016

    @ezyang
    ContributorAuthor

    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:

    1. 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.)
    2. We add a script to re-generate these binary serialized versions and admonishes you to bump the version.
    3. 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.

  24. hvr commented on Jan 19, 2016

    @hvr
    Member

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

  25. ezyang commented on Jan 19, 2016

    @ezyang
    ContributorAuthor

    Also note: bumping the version forces a rebuild of EVERYTHING. So we don't want to do it too frequently.

  26. ttuegel commented on Jan 20, 2016

    @ttuegel
    Member

    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?

  27. ezyang commented on Jan 20, 2016

    @ezyang
    ContributorAuthor

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

  28. ttuegel commented on Jan 20, 2016

    @ttuegel
    Member

    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.

  29. 23Skidoo commented on Feb 22, 2016

    @23Skidoo
    Member

    Closing in favour of #3181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions