Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install with Cabal 2.1 #37

Closed
tfausak opened this issue Sep 29, 2017 · 2 comments
Closed

Cannot install with Cabal 2.1 #37

tfausak opened this issue Sep 29, 2017 · 2 comments

Comments

@tfausak
Copy link

tfausak commented Sep 29, 2017

I am working on a project that requires features from the latest HEAD version of Cabal (see haskell/cabal#4799). Something in my dependency tree pulled in distributive which caused my build to fail with this error:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for cabal-doctest-1.0.2:
    Cabal-2.1.0.0 must match >=1.10 && <2.1 (latest applicable is 2.0.0.2)
needed due to example-0.0.0 -> cabal-doctest-1.0.2

Plan construction failed.

This puzzled me because I wasn't trying to build tests for any of my dependencies. Why is cabal-doctest needed for distributive's Setup.lhs?

I ran into this problem with Stack 1.5.1. I assume the same thing happens with cabal-install. Here is a minimal way to reproduce the problem:

# stack.yaml
resolver: lts-9.0

packages:
  - .
  - extra-dep: true
    location:
      commit: 4009c986805cd2648a980d6e88f4c50a38a43410
      git: https://github.com/haskell/cabal
    subdirs:
      - Cabal

extra-deps:
  - distributive-0.5.3
# package.yaml
name: example
version: 0.0.0

library:
  dependencies:
    - Cabal
    - distributive
@RyanGlScott
Copy link
Collaborator

This puzzled me because I wasn't trying to build tests for any of my dependencies.

Indeed, cabal-doctest isn't a test suite dependency, it's a custom-setup dependency. See here.

Why is cabal-doctest needed for distributive's Setup.lhs?

This is because in order to make the doctests work robustly, we have to generate an extra build module that hooks into Cabal's configure phase to generate all of the necessary metadata to pass to doctest. For better or worse, there's no way to have a custom-setup dependency that only gets installed if tests are enabled, so that is why cabal-doctest is installed unconditionally.

The real solution to your problem is to bump the upper version bounds on Cabal in cabal-doctest.

@tfausak
Copy link
Author

tfausak commented Sep 29, 2017

👉 ulidtko/cabal-doctest#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants