Skip to content

cabal configure making dependencies global #2725

Open
@dimitri-xyz

Description

@dimitri-xyz

I am running:

cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library

on OSX 10.9.5
with GCH 7.8.3 and the haskell platform 2014.2

I have a very simple .cabal file that builds two executables:

------------------------------------------------
name:                agent
version:             0.1.0.0
build-type:          Simple
cabal-version:       >=1.20

----------------------------------------------
executable myPersonalMain
    main-is:            Mpm.hs
    hs-source-dirs:     ./test
    ghc-options:       -main-is Mpm
    build-depends:
                base              >=4.4

    default-language:   Haskell2010

----------------------------------------------
executable agent
  main-is:             Main.hs
  hs-source-dirs: ./src

  build-depends:      base >=4.4 && <4.7
                    , unordered-containers >= 0.2.3.0
                    , unix >= 2.6.0.1
                    , process >= 1.1.0.2
                    , stm >= 2.4.2

  -- Base language which the package is written in.
  default-language:    Haskell2010
------------------------------------------------

If I comment out the "build-depends" section for the 2nd (agent) target. I am able to build the 1st (myPersonalMain). But if I try to build this as is, I get:

cabal build myPersonalMain
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring agent-0.1.0.0...
cabal: At least the following dependencies are missing:
base >=4.4 && <4.7

The problem is that 'cabal configure' needs to work and for that, the dependency on the second target (which I don't care about) has to be satisfied. That is a very confusing situation as it seems that the dependencies of the second target are required to build the first. (Ideally, I would like my build to succeed here, as I don't need base<4.7 to build the first target.)

In any case, I have to always have all 'build-depends:' sections satisfy 'cabal configure' to be able to build any single target. That makes a dependency in a tiny unimportant testing package, globally required for me to be able to build any target.

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