haskell / haskell/cabal

cabal build ./pkgfoo doesn't work

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

Description

**Describe the bug**

Hi Cabal maintainers, thank you for your work.

Accorting to the documentation provided by `--help`, I can tell cabal to build a package held in a specific directory.

```
$ cabal build --help
[snip]
Examples:
cabal build
Build the package in the current directory or all packages in the project
cabal build pkgname
Build the package named pkgname in the project
cabal build ./pkgfoo
Build the package in the ./pkgfoo directory
```

But this doesn't seem to work. See below for reproducible steps.

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

```
$ mkdir cabal-build-pkgfoo-test
$ cd cabal-build-pkgfoo-test
$ cabal init --minimal --non-interactive

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating CHANGELOG.md...
Generating app/Main.hs...
Generating cabal-build-pkgfoo-test.cabal...

Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.

$ cd ..
$ cabal v2-build ./cabal-build-pkgfoo-test
No cabal.project file or cabal file matching the default glob './*.cabal' was found.
Please create a package description file .cabal or a cabal.project file referencing the packages you want to build.
```

**Expected behavior**

I expect the package in `./cabal-build-pkgfoo-test` to be built. Likely the equivalent of `cd ./cabal-build-pkgfoo-test && cabal v2-build && cd ..`.

**System information**
- macOS Catalina, 10.15.7
- cabal-install version 3.4.0.0 (compiled using version 3.4.0.0 of the Cabal library)
- ghc version 8.10.4

Contributor guide

Open the contributing guide

Research direction

Reproduce the documented `cabal v2-build ./cabal-build-pkgfoo-test` command from the issue, then trace how cabal-install handles directory arguments and package/project discovery. Done means the package in the specified directory is built as expected and the corresponding `cabal build --help` example is accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.