haskell / haskell/cabal

cabal configure making dependencies global

Open
#2,725 5 comments 1 reaction 0 assignees View on GitHub
cabal-install: solver Cabal: other type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.