haskell / haskell/cabal

Question: Behaviour of `cabal install` vs `cabal build`? (Placement of build artefacts)

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

Description

I used to be under the assumption that `cabal install` basically boils down to cabal build and copying over executables.

Indeed when I run `cabal install cabal-install` in a cabal checkout it seems to build the checkout rather than the version published on hackage:

```
Starting cabal-install-3.19.0.0 (exe:cabal)
Building cabal-install-3.19.0.0 (exe:cabal)
Installing cabal-install-3.19.0.0 (exe:cabal)
Completed cabal-install-3.19.0.0 (exe:cabal)
```

However the binaries don't seem to be placed in dist-newstyle but some other place. As there is no `cabal.exe` in the checkout folder after `cabal install cabal-install`.

And if I run `cabal build` afterwards I rebuilds not just cabal but also some of the dependencies, ultimately producing a `cabal.exe` under dist-newstyle as expected.

------------------------------------

I suspect this is somehow related to the behaviour of `cabal configure` which states:

> The options of all of these flags apply only to local packages in a project; this behavior is different than that of cabal install, which applies flags to every package that would be built.

But I never explicitly invoked `cabal configure` so maybe transitively this is a reason, but still quite surprising.

Maybe this was always the case and I just never noticed. But it seems like surprising behaviour to me.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported commands in a Cabal checkout: `cabal install cabal-install` followed by `cabal build`. Trace where each command places build artefacts and why dependencies rebuild, then document the distinction and expected locations so the reported behavior is clearly explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.