commercialhaskell / commercialhaskell/stack

stack sdist cannot find autogenerated include file

Open
#5,222 1 comment 0 reactions 0 assignees View on GitHub
component: Cabal library further investigation required type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

This is an awkward issue with a number of moving parts: stack, Cabal, autotools, and the time library. I _think_ the bug is in stack, but I could be wrong. To reproduce:

1. Fetch the time library from https://github.com/haskell/time
2. Run `stack build`
3. Run `stack sdist`

Results:

```
$ stack sdist
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Getting file list for /home/ashley/Projects/Haskell/Time/time/
time> setup: can't find include file HsTimeConfig.h
time>

-- While building package time-1.10 using:
/home/ashley/Projects/Haskell/Time/time/.stack-work/dist/x86_64-linux/Cabal-3.0.1.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-3.0.1.0 sdist --list-sources /tmp/stack-sdist28443/source-files-list
Process exited with code: ExitFailure 1
```

I also tried `stack --resolver lts-14 sdist`, with the same problem.

`HsTimeConfig.h` is not a source file, but is built by `configure`. When stack builds the time library, the file ends up in `.stack-work/dist/x86_64-linux/Cabal-3.0.1.0/build/lib/include/HsTimeConfig.h` rather than in `lib/include/HsTimeConfig.h` where `stack sdist` seems to want it.

`HsTimeConfig.h` is mentioned in the `extra-tmp-files` field of `time.cabal`. However, the problem persists even if I remove it. It's not entirely clear to me that the file even needs to be in the distribution tarball, since it will be built by the configure script. My workaround is to run `configure` manually, which will put the file in the expected place.

### Stack version

```
$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
```

### Method of installation

* Official binary, downloaded from stackage.org or fpcomplete's package repository

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.