haskell / haskell/cabal

cabal new-build doesn't pick up existing build-tools in $PATH

Open
#6,608 5 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
According to the user guide, a pre-built executable presented in $PATH should be enough but thats not the case for `cabal new-build`
> A list of Haskell programs needed to build this component. Each may be followed by an optional version bound. Confusingly, each program in the list either refer to one of three things:
> 1. Another executables in the same package (supported since Cabal 1.12)
> 2. Tool name contained in Cabal’s hard-coded set of common tools
> 3. A pre-built executable that should already be on the PATH (supported since Cabal 2.0)

Instead, cabal tries to build the binary from scratch:
```
cabal: Could not resolve dependencies:
[__0] trying: language-tl-0.1.0.0 (user goal)
[__1] unknown package: language-tl:alex:exe.alex (dependency of language-tl)
[__1] fail (backjumping, conflict set: language-tl, language-tl:alex:exe.alex)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: language-tl, language-tl:alex:exe.alex
```

**To Reproduce**
Steps to reproduce the behavior:

1. enter nix-shell with alex and happy in $PATH
2. init project
3. add alex and happy to build-tools
4. run `cabal new-build`

Please use version-prefixed commands (e.g. `v2-build` or `v1-build`) to avoid ambiguity.

**Expected behavior**
cabal should try to search in $PATH before resort to building the binary.

**System information**
- Operating system: nixOS
- `cabal`, `ghc` versions
cabal: 3.0.0.0

**Additional context**
Add any other context about the problem here.

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.