cabal install --enable-relocatable error "Installation directories are not prefix_relative", v3.12+
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
cabal fails to install itself if the flag `--enable-relocatable` is used, with error `Installation directories are not prefix_relative: InstallDirs.libsubdir`.
**To Reproduce**
Steps to reproduce the behavior:
```
$ cabal --version
cabal-install version 3.14.1.1
compiled using version 3.14.1.1 of the Cabal library
$ cabal install cabal-install -j24 --install-method=copy --enable-relocatable
Resolving dependencies...
Build profile: -w ghc-9.6.6 -O1
In order, the following will be built (use -v for more details):
- base16-bytestring-1.0.2.0 (lib) (requires build)
- base64-bytestring-1.2.1.0 (lib) (requires build)
- cryptohash-sha256-0.11.102.1 (lib) (requires build)
- ed25519-0.0.5.0 (lib) (requires build)
…
- cabal-install-solver-3.14.1.0 (lib) (requires build)
- cabal-install-3.14.1.1 (lib) (requires build)
- cabal-install-3.14.1.1 (exe:cabal) (requires build)
Starting base16-bytestring-1.0.2.0 (lib)
Starting regex-base-0.94.0.2 (lib)
…
Installing cabal-install-solver-3.14.1.0 (lib)
Completed cabal-install-solver-3.14.1.0 (lib)
Starting cabal-install-3.14.1.1 (lib)
Failed to build cabal-install-3.14.1.1. The failure occurred during the
configure step.
Build log (
/Users/st15573/.cache/cabal/logs/ghc-9.6.6/cbl-nstll-3.14.1.1-5bb6e341.log ):
Configuring library for cabal-install-3.14.1.1...
Error: [Cabal-6000]
Installation directories are not prefix_relative:
internal error InstallDirs.libsubdir
CallStack (from HasCallStack):
error, called at src/Distribution/Simple/InstallDirs.hs:146:19 in Cabal-3.14.1.1-inplace:Distribution.Simple.InstallDirs
Error: [Cabal-7125]
Failed to build cabal-install-3.14.1.1 (which is required by exe:cabal from cabal-install-3.14.1.1). See the build log above for details.
```
**Expected behavior**
This install works if the flag `--enable-relocatable` is omitted. This works:
```
$ cabal install cabal-install -j24 --install-method=copy
```
**System information**
- macOS Sequoia
- `cabal` 3.14.1.1, `ghc` 9.6.6
The issue is observed to have started in `cabal` 3.12.1.0.
**Additional context**
Related: https://github.com/haskell/cabal/issues/10155
Contributor guide
Assessment
This issue has not been assessed yet.