haskell / haskell/cabal

"Unknown build target" when using Custom setup and `build-tool-depends`

Open
#8,043 0 comments 0 reactions 0 assignees View on GitHub
cabal-install: custom type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
Compilation fails when some project A has a Custom setup and some project B has a `build-tool-depends` on an executable from project A.

**To Reproduce**
```
git clone https://github.com/martijnbastiaan/cabal-build-tool-depends-issue.git
cd cabal-build-tool-depends-issue
cabal v2-build all
```

**Expected behavior**
I would expect a custom setup that loos like:

```
module Main where

import Distribution.Simple (defaultMain)

main :: IO ()
main = defaultMain
```

to behave the same as `build-type: Simple`, alas, it doesn't.

**Actual behavior**
```
$ cabal v2-build all
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- project-a-0.1.0.0 (exe:the-exe, exe:project-a) (additional components to build)
- project-b-0.1.0.0 (exe:project-b) (configuration changed)
setup: Unknown build target 'exe:project-a'.
There is no executable component 'project-a'.

cabal: Failed to build project-a-0.1.0.0 (which is required by exe:project-b
from project-b-0.1.0.0).
```

If I use a `Simple` build-type, it works as expected.

**System information**
- Ubuntu 20.04
- Cabal 3.6
- GHC 8.10

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.