Skip to content

Bad dependency solver error caused by unsat user goal #4139

Closed

Description

@ezyang

I'm not saying you should fix this directly, but this is an interesting little case that it is worth thinking about in the solver.

Steps to reproduce:

  1. Get a git checkout of cabal HEAD
  2. cabal unpack hackage-repo-tool
  3. Add to your cabal.project.local:
optional-packages: hackage-repo-tool-*/
  1. Run cabal new-build

You'll get the error:

cabal: Could not resolve dependencies:
trying: exceptions-0.8.0.2/installed-36a... (dependency of
cabal-testsuite-1.25.0.0)
trying: tagged-0.8.5 (dependency of semigroups-0.18.2:+tagged)
rejecting: tagged-0.8.5:+transformers (conflict: exceptions =>
transformers-compat==0.4.0.4/installed-8aa..., tagged-0.8.5:transformers =>
transformers-compat>=0.5 && <1)
rejecting: tagged-0.8.5:-transformers (manual flag can only be changed
explicitly)
Dependency tree exhaustively searched.

This is TOTALLY misleading. Pop over to -v3 output and you get something a lot better:

[_99] rejecting: aeson-1.0.2.1, aeson-1.0.2.0, aeson-1.0.1.0, aeson-1.0.0.0 (conflict: attoparsec => scientific==0.3.4.4/installed-ad7..., aeson => scientific>=0.3.4.7 && <0.4)
[_99] trying: aeson-0.11.2.1
[100] trying: aeson-0.11.2.1:!test
[101] trying: syb-0.6/installed-d15... (dependency of aeson-0.11.2.1)
[102] trying: fail-4.9.0.0 (dependency of aeson-0.11.2.1)
[103] trying: dlist-0.7.1.2/installed-bf3... (dependency of aeson-0.11.2.1)
[104] next goal: hackage-repo-tool (user goal)
[104] rejecting: hackage-repo-tool-0.1.1 (conflict: Cabal==1.25.0.0, hackage-repo-tool => Cabal>=1.12 && <1.25)
[104] rejecting: hackage-repo-tool-0.1.0.1, hackage-repo-tool-0.1.0.0 (constraint from user target requires ==0.1.1)
[__1] fail (backjumping, conflict set: Cabal, hackage-repo-tool)
[__0] rejecting: Cabal-1.24.1.0, Cabal-1.24.0.0, Cabal-1.22.8.0, Cabal-1.22.7.0, Cabal-1.22.6.0, Cabal-1.22.5.0/installed-811..., Cabal-1.22.5.0/installed-b80..., Cabal-1.22.5.0, Cabal-1.22.4.0, Cabal-1.22.3.0, Cabal-1.22.2.0, Cabal-1.22.1.1, Cabal-1.22.1.0, Cabal-1.22.0.0, Cabal-1.20.0.4, Cabal-1.20.0.3, Cabal-1.20.0.2, Cabal-1.20.0.1, Cabal-1.20.0.0, Cabal-1.18.1.7, Cabal-1.18.1.6, Cabal-1.18.1.5, Cabal-1.18.1.4, Cabal-1.18.1.3, Cabal-1.18.1.2, Cabal-1.18.1.1, Cabal-1.18.1, Cabal-1.18.0, Cabal-1.16.0.3, Cabal-1.16.0.2, Cabal-1.16.0.1, Cabal-1.16.0, Cabal-1.14.0, Cabal-1.12.0, Cabal-1.10.2.0, Cabal-1.10.1.0, Cabal-1.10.0.0, Cabal-1.8.0.6, Cabal-1.8.0.4, Cabal-1.8.0.2, Cabal-1.6.0.3, Cabal-1.6.0.2, Cabal-1.6.0.1, Cabal-1.4.0.2, Cabal-1.4.0.1, Cabal-1.4.0.0, Cabal-1.2.4.0, Cabal-1.2.3.0, Cabal-1.2.2.0, Cabal-1.2.1, Cabal-1.1.6 (constraint from user target requires ==1.25.0.0)
[__0] fail (backjumping, conflict set: Cabal, hackage-repo-tool)
cabal: Could not resolve dependencies:
trying: exceptions-0.8.0.2/installed-36a... (dependency of
cabal-testsuite-1.25.0.0)
trying: tagged-0.8.5 (dependency of semigroups-0.18.2:+tagged)
rejecting: tagged-0.8.5:+transformers (conflict: exceptions =>
transformers-compat==0.4.0.4/installed-8aa..., tagged-0.8.5:transformers =>
transformers-compat>=0.5 && <1)
rejecting: tagged-0.8.5:-transformers (manual flag can only be changed
explicitly)

The very last few entries from the log say exactly what the problem is. I don't know why the solver then goes insane and reports something completely nonsense.

CC @GrayJay

Activity

  1. sebright commented on Nov 27, 2016

    @sebright
    Collaborator

    Yes, that is very confusing. It looks like #941. The solver always prints the first error it encountered, even if it's not important.

    I think my suggestion in #941 (comment) would also work in this case, because the final conflict set is small, just {Cabal, hackage-repo-tool}. If we reran the solver and made it prefer those two goals, it would print an error similar to the last lines of the -v3 log.

  2. ezyang commented on Nov 27, 2016

    @ezyang
    ContributorAuthor

    That sounds good to me!

  3. sebright commented on Dec 4, 2016

    @sebright
    Collaborator

    Closing as a duplicate of #941.

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