Skip to content

Confusing cabal solver install plan #1532

Closed

Description

@hvr

Using

$ ghc --version; cabal --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
cabal-install version 1.18.0.2
using version 1.18.0 of the Cabal library 

with the dummy.cabal contents

name:                dummy
version:             0.1.0.0
license:             GPL-3
license-file:        LICENSE
author:              HVR
maintainer:          [email protected]
build-type:          Simple
cabal-version:       >=1.10

executable dummy
  main-is: dummy.hs
  build-depends:       base >=4.6 && <4.8
  default-language:    Haskell2010

test-suite test1
  main-is: dummy.hs
  type: exitcode-stdio-1.0
  default-language: Haskell2010
  build-depends: test-framework==0.8.*, test-framework-quickcheck2==0.3.*, QuickCheck==2.5.*

Then if I install some packages into the sandbox...

$ cabal sandbox init
$ cabal install QuickCheck-2.6
$ cabal install --enable-test --dep --dry
Resolving dependencies...
In order, the following would be installed (use -v for more details):
QuickCheck-2.5.1.1 (latest: 2.6)
ansi-terminal-0.6
ansi-wl-pprint-0.6.6
extensible-exceptions-0.1.1.4
hostname-1.0
text-0.11.3.1
transformers-0.3.0.0
mtl-2.1.2
regex-base-0.93.2
regex-posix-0.95.2
xml-1.3.13
test-framework-0.8
test-framework-quickcheck2-0.3.0.1
$ cabal install --enable-test --dep

...and now try to cabal install, cabal would try to install test-framework-quickcheck2-0.2.4 even though tests are not to be built, and even if they were to be built, that version would not be within the version constraints:

$ cabal install --disable-test --dry 
Resolving dependencies...
In order, the following would be installed (use -v for more details):
dummy-0.1.0.0
test-framework-quickcheck2-0.2.4 (latest: 0.3.0.1)

Activity

  1. hvr commented on Oct 5, 2013

    @hvr
    MemberAuthor

    Here's the -v3 output from the last command for completeness:

    $ cabal install --disable-test -v2 --dry 
    Using a sandbox located at /home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox
    Reading available packages...
    Reading available packages...
    Reading installed packages...
    '/opt/ghc/7.6.3/bin/ghc-pkg' 'dump' '--package-db=/home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d' '-v0'
    '/opt/ghc/7.6.3/bin/ghc' '--print-libdir'
    Reading available packages...
    Choosing modular solver.
    Resolving dependencies...
    In order, the following would be installed:
    dummy-0.1.0.0 (new package)
    test-framework-quickcheck2-0.2.4 (latest: 0.3.0.1) (new version)
    hvr@duo:~/Haskell/bugs/cabal-solver$ cabal install --disable-test --dry 
    Resolving dependencies...
    In order, the following would be installed (use -v for more details):
    dummy-0.1.0.0
    test-framework-quickcheck2-0.2.4 (latest: 0.3.0.1)
    hvr@duo:~/Haskell/bugs/cabal-solver$ cabal install --disable-test -v3 --dry 
    Using a sandbox located at /home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox
    Searching for ghc in path.
    Found ghc at /opt/ghc/7.6.3/bin/ghc
    ("/opt/ghc/7.6.3/bin/ghc",["--numeric-version"])
    /opt/ghc/7.6.3/bin/ghc is version 7.6.3
    looking for tool ghc-pkg near compiler in /opt/ghc/7.6.3/bin
    found ghc-pkg in /opt/ghc/7.6.3/bin/ghc-pkg
    ("/opt/ghc/7.6.3/bin/ghc-pkg",["--version"])
    /opt/ghc/7.6.3/bin/ghc-pkg is version 7.6.3
    ("/opt/ghc/7.6.3/bin/ghc",["--supported-languages"])
    ("/opt/ghc/7.6.3/bin/ghc",["--info"])
    The package database already exists:
    /home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
    Reading available packages...
    Reading available packages...
    Reading installed packages...
    ("/opt/ghc/7.6.3/bin/ghc-pkg",["dump","--package-db=/home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d","-v0"])
    ("/opt/ghc/7.6.3/bin/ghc",["--print-libdir"])
    Reading installed packages...
    ("/opt/ghc/7.6.3/bin/ghc-pkg",["dump","--global","-v0"])
    ("/opt/ghc/7.6.3/bin/ghc-pkg",["dump","--package-db=/home/hvr/Haskell/bugs/cabal-solver/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d","-v0"])
    ("/opt/ghc/7.6.3/bin/ghc",["--print-libdir"])
    Reading available packages...
    Choosing modular solver.
    Resolving dependencies...
    [__0] trying: QuickCheck-2.6/installed-e3d... (user goal)
    [__1] trying: base-4.6.0.1/installed-8aa... (dependency of QuickCheck-2.6/installed-e3d...)
    [__2] trying: rts-1.0/installedbuil... (dependency of base-4.6.0.1/installed-8aa...)
    [__3] trying: integer-gmp-0.5.0.0/installed-2f1... (dependency of base-4.6.0.1/installed-8aa...)
    [__4] trying: ghc-prim-0.3.0.0/installed-d52... (dependency of base-4.6.0.1/installed-8aa...)
    [__5] trying: template-haskell-2.8.0.0/installed-a30... (dependency of QuickCheck-2.6/installed-e3d...)
    [__6] trying: pretty-1.1.1.0/installed-661... (dependency of template-haskell-2.8.0.0/installed-a30...)
    [__7] trying: containers-0.5.0.0/installed-ab1... (dependency of template-haskell-2.8.0.0/installed-a30...)
    [__8] trying: deepseq-1.3.0.1/installed-5cc... (dependency of containers-0.5.0.0/installed-ab1...)
    [__9] trying: array-0.4.0.1/installed-3b7... (dependency of containers-0.5.0.0/installed-ab1...)
    [_10] trying: QuickCheck-2.6/installed-e3d... (user goal)
    [_11] trying: ansi-terminal-0.6/installed-0cc... (user goal)
    [_12] trying: unix-2.6.0.1/installed-f12... (dependency of ansi-terminal-0.6/installed-0cc...)
    [_13] trying: time-1.4.0.1/installed-10d... (dependency of unix-2.6.0.1/installed-f12...)
    [_14] trying: old-locale-1.0.0.5/installed-672... (dependency of time-1.4.0.1/installed-10d...)
    [_15] trying: bytestring-0.10.0.2/installed-4f9... (dependency of unix-2.6.0.1/installed-f12...)
    [_16] trying: ansi-wl-pprint-0.6.6/installed-fb6... (user goal)
    [_17] trying: extensible-exceptions-0.1.1.4/installed-255... (user goal)
    [_18] trying: hostname-1.0/installed-7cd... (user goal)
    [_19] trying: mtl-2.1.2/installed-94c... (user goal)
    [_20] trying: random-1.0.1.1/installed-43f... (user goal)
    [_21] trying: regex-base-0.93.2/installed-f94... (user goal)
    [_22] trying: regex-posix-0.95.2/installed-a7e... (user goal)
    [_23] trying: test-framework-0.8/installed-e81... (user goal)
    [_24] next goal: test-framework-quickcheck2 (user goal)
    [_24] rejecting: test-framework-quickcheck2-0.3.0.1/installed-1d0... (conflict: QuickCheck==2.6/installed-e3d..., test-framework-quickcheck2 => QuickCheck==2.5.1.1/installed-4f8...)
    [_24] rejecting: test-framework-quickcheck2-0.3.0.1, 0.3.0, 0.2.12.4, 0.2.12.3 (conflict: QuickCheck==2.6/installed-e3d..., test-framework-quickcheck2 => QuickCheck>=2.4 && <2.6)
    [_24] rejecting: test-framework-quickcheck2-0.2.12.2, 0.2.12.1 (conflict: QuickCheck==2.6/installed-e3d..., test-framework-quickcheck2 => QuickCheck>=2.4 && <2.5)
    [_24] rejecting: test-framework-quickcheck2-0.2.12, 0.2.11, 0.2.10 (conflict: test-framework==0.8/installed-e81..., test-framework-quickcheck2 => test-framework>=0.2.0 && <0.5.0)
    [_24] rejecting: test-framework-quickcheck2-0.2.9, 0.2.8, 0.2.7, 0.2.6 (conflict: test-framework==0.8/installed-e81..., test-framework-quickcheck2 => test-framework>=0.2.0 && <0.4.0)
    [_24] rejecting: test-framework-quickcheck2-0.2.5 (conflict: test-framework==0.8/installed-e81..., test-framework-quickcheck2 => test-framework>=0.2.0 && <0.3.0)
    [_24] trying: test-framework-quickcheck2-0.2.4
    [_25] trying: test-framework-quickcheck2-0.2.4:+base4
    [_26] trying: test-framework-quickcheck2-0.2.4:-base3
    [_27] trying: text-0.11.3.1/installed-e38... (user goal)
    [_28] trying: transformers-0.3.0.0/installed-ff2... (user goal)
    [_29] trying: xml-1.3.13/installed-883... (user goal)
    [_30] trying: dummy-0.1.0.0 (user goal)
    [_31] trying: dummy-0.1.0.0:!test
    [_32] done
    In order, the following would be installed:
    dummy-0.1.0.0 (new package)
    test-framework-quickcheck2-0.2.4 (latest: 0.3.0.1) (new version)
    
  2. tibbe commented on Nov 28, 2013

    @tibbe
    Contributor

    @kosmikus would you mind doing an initial triage, just to describe what's going on?

  3. kosmikus commented on Nov 28, 2013

    @kosmikus
    Contributor

    I think that @23Skidoo knows the sandbox stuff better than I do. Here's what seems to happen according to the -v3 log:

    QuickCheck-2.6 seems to be installed in the sandbox (possibly next to QuickCheck-2.5? I thought that's not possible?). Within a sandbox, there's an attempt to create a consistent install plan with all installed packages, so both QuickCheck and test-framework-quickcheck2 which are currently installed become user goals. But they turn out to be inconsistent.

    Right now, it's unclear to me if this is a problem that should be solved within the solver somehow, or whether the solver could be invoked with better arguments to make it clear what's desired.

  4. added this to the milestone on Apr 23, 2015
  5. modified the milestones: Cabal 1.24, on Feb 21, 2016
  6. modified the milestone: Cabal 2.0 on Sep 6, 2016
  7. gbaz commented on Aug 28, 2021

    @gbaz
    Collaborator

    closing as obsolete

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions