haskell / haskell/cabal

Error message for missing package list is unclear when looking for build-tool-depends

Open
#7,197 4 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

When the package list is missing, `build-tool-depends` causes a cryptic error message.

cc @chuahou

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

See https://stackoverflow.com/a/65287190/428586

```
$ rm -rf ~/.cabal

$ cabal v2-build
[... omitted ...]
[__0] trying: aoc-0.1.0.0 (user goal)
[__1] unknown package: aoc:happy:exe.happy (dependency of aoc)
[__1] fail (backjumping, conflict set: aoc, aoc:happy:exe.happy)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: aoc, aoc:happy:exe.happy

$ cabal update
Downloading the latest package list from hackage.haskell.org

$ cabal v2-build
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- alex-3.2.6 (exe:alex) (requires download & build)
- happy-1.20.0 (exe:happy) (requires download & build)
- aoc-0.1.0.0 (lib) (configuration changed)
- aoc-0.1.0.0 (exe:aoc) (dependency rebuilt)
Downloading happy-1.20.0
[... omitted ...]
Configuring library for aoc-0.1.0.0..
Preprocessing library for aoc-0.1.0.0..
Building library for aoc-0.1.0.0..
[... omitted ...]
```

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

**Expected behavior**

A clear error message indicating that the package list wasn't present on the system.
Perhaps it could be downloaded automatically.

**System information**
- Operating system
- `cabal`, `ghc` versions

**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.