Fails to find install plan for containers package tests #935

bos opened this Issue May 24, 2012 · 6 comments


None yet

4 participants

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 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 is version 7.4.1
Reading installed packages...
Reading available packages...
Choosing modular solver.
Resolving dependencies...
[__0] trying: containers- (user goal)
[__1] next goal: base (dependency of containers-
[__1] rejecting: base-, (global constraint requires installed instance)
[__1] trying: base-
[__2] trying: rts-1.0/installedbuil... (dependency of base-
[__3] trying: integer-gmp- (dependency of base-
[__4] rejecting: containers-!test (global constraint requires opposite flag selection)
[__4] trying: containers-*test
[__5] trying: test-framework-quickcheck2- (dependency of containers-*test)
[__6] trying: test-framework-quickcheck2-
[__7] trying: test-framework-quickcheck2-
[__8] trying: random- (dependency of test-framework-quickcheck2-
[__9] trying: time-1.4/installed-3e1... (dependency of random-
[_10] trying: old-locale- (dependency of time-1.4/installed-3e1...)
[_11] trying: extensible-exceptions- (dependency of test-framework-quickcheck2-
[_12] trying: test-framework-hunit-0.2.7 (dependency of containers-*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-*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- (dependency of xml-1.3.12)
[_21] trying: bytestring- (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- (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- (dependency of ansi-terminal-0.5.5)
[_37] trying: QuickCheck-2.4.2 (dependency of containers-*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- (conflict: containers==, template-haskell => containers==
[_41] trying: template-haskell-
[_42] trying: pretty- (dependency of template-haskell-
[_43] trying: HUnit- (dependency of containers-*test)
[_44] trying: HUnit-
[_45] trying: ghc-prim- (dependency of containers-
[_46] trying: deepseq- (dependency of containers-
[_47] next goal: array (dependency of containers-
[_47] trying: array-
[_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-, test-framework-quickcheck2-, QuickCheck-2.4.2, template-haskell-
@kosmikus kosmikus was assigned May 24, 2012
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 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 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 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 commented Jun 13, 2016

See also #960 and PR #3422

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