Skip to content

The "benchmark" target dependencies conflict with "executable" targets #1768

Closed

Description

@nikita-volkov

I have a package with the following structure:

library
  ...
executable measure-memory
  ...
  build-depends:
    ghc-datasize,
    ...
benchmark benchmarks
  ...
  build-depends:
    criterion == 0.8.*,
    ...

The criterion == 0.8.* dependency conflicts with ghc-datasize and its impossible to compile having those two together. The issue with Cabal however is that neither the benchmark or library target has ghc-datasize in dependencies, yet Cabal still considers it and does not allow me to compile the benchmark target. When I remove the executable target, the compilation goes fine.

I'm on

$ cabal --version
cabal-install version 1.19.2
using version 1.19.2 of the Cabal library 

Activity

  1. tibbe commented on Apr 11, 2014

    @tibbe
    Contributor

    /cc @kosmikus

    This is a limitation of the dependency solver and it bites us in a bunch of different situations. :(

    Another example of when it bites us is when a cycle is created because a dependency of a test suite in turn depends on the main library. This happens in all core packages that are used by e.g. test-framework or criterion.

  2. nikita-volkov commented on Apr 11, 2014

    @nikita-volkov
    ContributorAuthor

    BTW, I've just checked and the problem remains even when I change the target from benchmark benchmarks to executable benchmarks. So it looks like the issue is that it shares dependencies across all executables and benchmarks.

  3. tibbe commented on Apr 11, 2014

    @tibbe
    Contributor

    Yes, the issue is that the whole package is considered as a unit for dependency resolution.

  4. kosmikus commented on Apr 17, 2014

    @kosmikus
    Contributor

    @tibbe You've said repeatedly that this is a solver shortcoming, but I don't see the solver as the main culprit. Can we build individual components of packages out of order? If yes, I'm happy to try to make the necessary solver changes.

  5. tibbe commented on Apr 17, 2014

    @tibbe
    Contributor

    @kosmikus Yes, I think we can and should consider each section (i.e. the lib, exes, test suites, and benchmarks) as separate units, with their own constraints, to build.

  6. 23Skidoo commented on Apr 20, 2014

    @23Skidoo
    Member

    Cabal has an internal component dependency graph. This information needs to be communicated to the solver.

  7. added this to the milestone on Apr 24, 2015
  8. 23Skidoo commented on Feb 18, 2016

    @23Skidoo
    Member

    Closing as a duplicate of #1575.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions