Fails to find install plan for containers package tests #935

Closed
bos opened this Issue May 24, 2012 · 6 comments

Projects

None yet

4 participants

@bos
bos commented May 24, 2012

(Imported from Trac #945, reported by @tibbe on 2012-04-24)

The containers package has a test-suite section which seems to create a cycle when building the package. Could it be that Cabal treats the package as one unit instead of treating the library and test-suite sections separately, which should remove the cycle.

$ cabal install --enable-tests -v3
searching for ghc in path.
found ghc at /usr/local/bin/ghc
("/usr/local/bin/ghc",["--numeric-version"])
/usr/local/bin/ghc is version 7.4.1
looking for tool "ghc-pkg" near compiler in /usr/local/bin
found ghc-pkg in /usr/local/bin/ghc-pkg
("/usr/local/bin/ghc-pkg",["--version"])
/usr/local/bin/ghc-pkg is version 7.4.1
("/usr/local/bin/ghc",["--supported-languages"])
("/usr/local/bin/ghc",["--info"])
Reading installed packages...
("/usr/local/bin/ghc-pkg",["dump","--global","-v0"])
("/usr/local/bin/ghc-pkg",["dump","--user","-v0"])
("/usr/local/bin/ghc",["--print-libdir"])
Reading available packages...
Choosing modular solver.
Resolving dependencies...
[__0] trying: containers-0.5.0.0 (user goal)
[__1] next goal: base (dependency of containers-0.5.0.0)
[__1] rejecting: base-3.0.3.2, 3.0.3.1 (global constraint requires installed instance)
[__1] trying: base-4.5.0.0/installed-f76...
[__2] trying: rts-1.0/installedbuil... (dependency of base-4.5.0.0/installed-f76...)
[__3] trying: integer-gmp-0.4.0.0/installed-ec8... (dependency of base-4.5.0.0/installed-f76...)
[__4] rejecting: containers-0.5.0.0:!test (global constraint requires opposite flag selection)
[__4] trying: containers-0.5.0.0:*test
[__5] trying: test-framework-quickcheck2-0.2.12.1 (dependency of containers-0.5.0.0:*test)
[__6] trying: test-framework-quickcheck2-0.2.12.1:+base4
[__7] trying: test-framework-quickcheck2-0.2.12.1:-base3
[__8] trying: random-1.0.1.1/installed-3be... (dependency of test-framework-quickcheck2-0.2.12.1:+base4)
[__9] trying: time-1.4/installed-3e1... (dependency of random-1.0.1.1/installed-3be...)
[_10] trying: old-locale-1.0.0.4/installed-29b... (dependency of time-1.4/installed-3e1...)
[_11] trying: extensible-exceptions-0.1.1.4/installed-d27... (dependency of test-framework-quickcheck2-0.2.12.1)
[_12] trying: test-framework-hunit-0.2.7 (dependency of containers-0.5.0.0:*test)
[_13] trying: test-framework-hunit-0.2.7:+base4
[_14] trying: test-framework-hunit-0.2.7:-base3
[_15] trying: test-framework-0.6 (dependency of containers-0.5.0.0:*test)
[_16] trying: test-framework-0.6:-tests
[_17] trying: test-framework-0.6:+splitbase
[_18] trying: hostname-1.0 (dependency of test-framework-0.6)
[_19] trying: xml-1.3.12 (dependency of test-framework-0.6)
[_20] trying: text-0.11.2.0/installed-a62... (dependency of xml-1.3.12)
[_21] trying: bytestring-0.9.2.1/installed-4ad... (dependency of xml-1.3.12)
[_22] trying: regex-posix-0.95.1 (dependency of test-framework-0.6)
[_23] trying: regex-posix-0.95.1:+splitbase
[_24] trying: regex-posix-0.95.1:+newbase
[_25] trying: regex-base-0.93.2 (dependency of regex-posix-0.95.1:+newbase)
[_26] trying: regex-base-0.93.2:+splitbase
[_27] trying: regex-base-0.93.2:+newbase
[_28] trying: mtl-2.1/installed-0a8... (dependency of regex-base-0.93.2:+newbase)
[_29] trying: transformers-0.3.0.0/installed-f23... (dependency of mtl-2.1/installed-0a8...)
[_30] trying: ansi-wl-pprint-0.6.4 (dependency of test-framework-0.6)
[_31] trying: ansi-wl-pprint-0.6.4:+newbase
[_32] trying: ansi-wl-pprint-0.6.4:-example
[_33] trying: ansi-terminal-0.5.5 (dependency of test-framework-0.6)
[_34] trying: ansi-terminal-0.5.5:+splitbase
[_35] trying: ansi-terminal-0.5.5:-example
[_36] trying: unix-2.5.1.0/installed-346... (dependency of ansi-terminal-0.5.5)
[_37] trying: QuickCheck-2.4.2 (dependency of containers-0.5.0.0:*test)
[_38] trying: QuickCheck-2.4.2:+templatehaskell
[_39] trying: QuickCheck-2.4.2:+base4
[_40] trying: QuickCheck-2.4.2:+base3
[_41] next goal: template-haskell (dependency of QuickCheck-2.4.2:+templatehaskell)
[_41] rejecting: template-haskell-2.7.0.0/installed-164... (conflict: containers==0.5.0.0, template-haskell => containers==0.4.2.1/installed-7c5...)
[_41] trying: template-haskell-2.7.0.0
[_42] trying: pretty-1.1.1.0/installed-7e1... (dependency of template-haskell-2.7.0.0)
[_43] trying: HUnit-1.2.4.2 (dependency of containers-0.5.0.0:*test)
[_44] trying: HUnit-1.2.4.2:+base4
[_45] trying: ghc-prim-0.2.0.0/installed-bd2... (dependency of containers-0.5.0.0)
[_46] trying: deepseq-1.3.0.0/installed-6c1... (dependency of containers-0.5.0.0)
[_47] next goal: array (dependency of containers-0.5.0.0)
[_47] trying: array-0.4.0.0/installed-0b3...
[_48] done
cabal: internal error: could not construct a valid install plan.
The proposed (invalid) plan contained the following problems:
The following packages are involved in a dependency cycle test-framework-hunit-0.2.7, test-framework-0.6, regex-posix-0.95.1, regex-base-0.93.2, containers-0.5.0.0, test-framework-quickcheck2-0.2.12.1, QuickCheck-2.4.2, template-haskell-2.7.0.0
@kosmikus kosmikus was assigned May 24, 2012
@bos
bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-04-24)

Ok, I can confirm the problem by using the Github version of containers on a plain ghc-7.4.1 installation.

The problem is actually not a solver problem, as I first thought, but a more fundamental problem in Cabal. It's also independent of using the modular solver.

So the problem here is that the testsuite of containers indirectly depends on containers again. The question is whether this should be allowed.

Fixing this would indeed mean that we should be able to build containers first, then the dependencies of the test framework, and finally the testsuite. We'd indeed have to introduce a possibility to build flavours or parts of packages in isolation. It'd for example be nice to be able to separately build non-profiling and profiling versions of a lib.

However, I'm afraid this change will take some more careful design, so don't expect a quick fix.

@bos
bos commented May 24, 2012

(Imported comment by @tibbe on 2012-04-24)

When I think about it I believe I've seen this problem before, with benchmarks. I generally hack on lower-level libraries and my test and benchmark dependencies indirectly depend on the library I'm working on quite often nowadays (e.g. Criterion depends on unordered-containers and I use Criterion to benchmark unordered-containers.)

@bos
bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-04-24)

A workaround for the low-level libraries might be to manually split into containers and containers-tests.

@bos
bos commented Jul 10, 2012

Splitting is kind of a pain, although it does work.

@grayjay grayjay added solver and removed linux labels May 28, 2016
@dcoutts
Member
dcoutts commented Jun 13, 2016

See also #960 and PR #3422

@grayjay
Collaborator
grayjay commented Nov 5, 2016

I'm closing this in favor of #1575, which has more discussion.

@grayjay grayjay closed this Nov 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment