haskell / haskell/cabal

Cannot install foreign library

Open
#8,890 0 comments 0 reactions 0 assignees View on GitHub
cabal-install: cmd/install type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
There is no predicable way to install foreign library components using `cabal-install`. The `install` command only installs executables.

My current workaround is to fall back on the `runhaskell Setup.hs` interface, so I can use the `copy` command.

**To Reproduce**
Steps to reproduce the behavior:

```
# Create a package with only a foreign library called mylib
$ cabal v2-install mylib --installdir=some/directory/
```

**Expected behavior**
Cabal copies the built foreign library to `some/directory`.

**System information**
- macOS 13
- Cabal 3.8.1.0
- GHC 9.4.4

**Additional context**
As far as I can tell, there is no way to use `cabal-install` to reliably copy a built foreign library out of `dist-newstyle` other than writing a custom `Setup.hs` script with a `postBuild` hook. Even then, there is no way to reliably pass the desired installation directory, except, perhaps, via an environment variable.

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.