commercialhaskell / commercialhaskell/stack
Problems with build-tools support in Stack
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
It appears that Stack doesn't properly supports constraints in the `build-tools` stanza of Cabal. An example of this could be seen in the repo https://github.com/qrilka/hsc2hs-fail [quoting](https://github.com/qrilka/hsc2hs-fail#stack-doesnt-manage-build-tools-constraints):
---
It appears that lts-14.27 includes `hsc2hs-0.68.6` and with the lines
```
#build-tools:
#- hsc2hs >= 0.68.6
```
commented out from the `package.yaml` we get a build failure because the version 0.68.5 from GHC-8.6.5 gets used. Uncommenting the constraint above gives a unsatisfied version failure from Cabal.
One could build `hsc2hs` manually with `stack build hsc2hs` and that adds the version 0.68.6 into the Stack's path:
$ stack exec -- hsc2hs --version
hsc2hs version 0.68.6
But it appears that stack build could only use `hsc2hs` shipped with GHC.
---
It appears that [the documentation](https://docs.haskellstack.org/en/stable/faq/#how-do-i-get-extra-build-tools) doesn't tell explicitly if `build-tools` stanza is fully supported.
Also it looks like the problem in #5242 should also come from incorrect handling of `build-tools`. My incomplete investigation showed that Stack sets `--bindir` when configuring Cabal project but that doesn't seem to be used for build tools and it looks like required tools should appear in the `$PATH`.
### Stack version
```
$ stack --version
2.1.3.1 x86_64 hpack-0.33.0
```
### Method of installation
* Other (please specify) - nixpkgs (not on NixOS)
Contributor guide
Assessment
This issue has not been assessed yet.