Skip to content

Cabal-1.22.6.0 incompatible with binary-0.8 #3003

Closed

Description

@hvr

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

  1. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    Sadly, I don't know if we can fix the situation for pre-setup-depends cabals at all... :-/

    /cc @edsko @dcoutts

  2. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    you can install Cabal if you do cabal configure --ghc-options=-DMIN_VERSION_binary_0_8_0=1;
    unfortunately it's something you just have to know :(

  3. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    @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 :-(

  4. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    Btw, adding custom-setup section with setup-depends mirroring library's build-depends doesn't work either for Cabal... so it seems we can't even fix this easily for setup-depends aware Cabals :-(

    Resolving dependencies...
    
    Distribution/Simple/Utils.hs:202:18:
        Could not find module ‘Paths_Cabal’
        it is a hidden module in the package ‘Cabal-1.22.5.0@Cabal_3ux67khMI118y6VpwrFnXN’
        Use -v to see a list of the files searched for.
    

    and adding Cabal as a dependency is a bad idea, as it sends the solver into an endless loop...

  5. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    @hvr, I'm not sure if reinstallation of Cabal is 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 setting binary <0.8 on ghc <8.0.

    Which OTOH might be good enough?

  6. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    With the new custom-setup feature, reinstallation of Cabal will happen, as this feature was added to allow us to specify which Cabal package version range a Setup.hs file 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

  7. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    I'm ok, with

    • changing binary <0.8 for just release Cabal
    • making
    if impl (ghc >= 8.0)
      binary <0.9
    else
      binary <0.8
    

    for yet another release, if we really need binary-0.8 support

  8. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    @phadej are you sure that works?

    I.e. if I do something like

    cabal-1.22 install Cabal --constraint 'binary < 0.8'
    

    I run into the very same build-failure, because version constraints don't apply to Setup.hs whatsoever.

  9. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    @hvr, what if the if Impl ghc is added to custom-setup ? So it could work with custom-setup aware cabal and recent enough ghc? Or is there still so corner cases?

  10. hvr commented on Dec 28, 2015

    @hvr
    MemberAuthor

    Once you can use custom-setup (which requires Cabal>=1.24, but this is broken for self-bootstrapping Cabal anyway, currently - but I have an idea for that one...), you also get properly working MIN_VERSION_... macros anyway. So there's no need to reject binary-0.8 in that case :-/

    We would only need to reject binary-0.8 for the pre-1.24 situation where have no way yet to do so :-/

  11. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    Extreme solution, would to have Cabal's master(and 1.24) be binary >= 0.8; and 1.22 series with <0.8?

  12. phadej commented on Dec 28, 2015

    @phadej
    Collaborator

    Yet, the problem will probably still exist if user has both binary-0.7 and binary-0.8 in package database, GHC will probably pick 0.8 for Setup compilation?

  13. ezyang commented on Dec 28, 2015

    @ezyang
    Contributor

    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.

  14. 55 remaining items

  15. 23Skidoo commented on Jan 29, 2016

    @23Skidoo
    Member

    Quite the opposite: cabal-install only attempts to globally cache the Setup script when it's NOT build-type: Custom. (Think about it; it makes no sense to cache a Custom setup script!)

    OK, I think we agree that for build-type: Simple we should compile the setup script with -i instead of -i -i.. It will also fully fix the binary-0.8 issue for the users of up-to-date cabal-install versions.

    Then if we revert the hs-source-dirs: src change we'll have the following situation:

    build-type: Custom build-type: Simple, hs-source-dirs: .
    cabal-install without e2bf243 and b453d30 works as expected, incompatible with binary-0.8 accidental bootstrapping, benign cache poisoning (cached setup-1.22 is setup-1.22), incompatible with binary-0.8 (without -j1)
    cabal-install with e2bf243 and b453d30 works as expected, incompatible with binary-0.8 works as expected, compatible with binary-0.8

    So we won't have to worry about cache poisoning and the "unrecognized options" error. And we can tell people running into the binary-0.8 error when upgrading to either do ghc-pkg hide binary-0.8 or run cabal install -j1 Cabal && cabal install cabal-install.

  16. ezyang commented on Jan 29, 2016

    @ezyang
    Contributor

    or run cabal install -j1 Cabal && cabal install cabal-install

    Just to be totally clear, this workaround only helps for the build-type: Simple, hs-source-dirs: . situation.

    Another problem with the binary-0.8 hide 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.

  17. 23Skidoo commented on Jan 29, 2016

    @23Skidoo
    Member

    Just to be totally clear, this workaround only helps for the build-type: Simple, hs-source-dirs: . situation.

    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.

  18. 23Skidoo commented on Jan 30, 2016

    @23Skidoo
    Member

    Reverted the hs-source-dirs: src change and changed D.C.SetupWrapper to pass -i -i. to GHC only when compiling Custom setup scripts. Now we only need to cut new cabal-install releases and then this can be marked as fixed.

  19. rthomas commented on Jan 31, 2016

    @rthomas

    I've released cabal-install 1.22.8.0, 1.20.2.0 and 1.18.2.0, so I'll close this issue.

  20. 23Skidoo commented on Jan 31, 2016

    @23Skidoo
    Member

    Thanks to everyone involved!

  21. added 3 commits that reference this issue on Mar 5, 2016
    8ce5ad3
    af04b4e
    3c95d81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions