haskell / haskell/cabal

Setup.hs configure with autoconf build type runs configure script in the wrong working directory

Open
#7,677 9 comments 0 reactions 0 assignees View on GitHub
attention: needs-help Cabal: other
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
When building a package with `build-type: Configure`, the configure script is run with the build directory as the working directory, rather than the source directory. If the configure script attempts to include a header file relative to the source directory, it doesn't work.

**To Reproduce**
Minimal repro: https://github.com/TerrorJack/cabal-configure-pwd-issue-repro. The repro above is minimized from the `base` package. Run `autoreconf -i` to generate `configure` script.

Running `cabal act-as-setup --build-type=Configure configure` will fail to execute the configure script:

```
Configuring cabal-configure-pwd-issue-repro-0.1.0.0...
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking for struct MD5Context... no
configure: error: internal error
```

While running `./configure` manually will succeed.

**System information**
- Operating system: Linux 5.5.9, Debian bullseye
- `cabal-3.4.0.0`
- `ghc-9.0.1`

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.