haskell / haskell/cabal

Cabal 3.8 expects `pkg-config --libs --static` to always work.

Open
#8,455 31 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome re: pkg-config regression in 3.8 type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

See https://github.com/haskell/cabal/commit/bf32602db5770a312fe632b997ff9b7c7e4d0329 and https://github.com/input-output-hk/haskell.nix/issues/1642

I think it is unreasonable for cabal to expect `pkg-config --libs --static` to work when only dynamic libraries may be installed on a system.

**To Reproduce**

```
$ cabal --version
cabal-install version 3.9
compiled using version 3.9.0.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
$ cabal v2-install haskell-gi-base -v3
...
```

In `setup configure` for `haskell-gi-base` you will see it has both:

```
Running: SOME_PATH/pkg-config --libs gobject-2.0 glib-2.0
Running: SOME_PATH/pkg-config --libs --static gobject-2.0 glib-2.0
```

On nix you can run something like this to see the second one fail:
```
nix-shell -E 'let pkgs = import {}; in pkgs.mkShell { buildInputs = [ pkgs.gtk4.dev pkgs.pkgconfig ]; }' --run 'cabal v2-install haskell-gi-base -v3'
```

**Expected behavior**
Perhaps cabal could store the error and replay it when the linker arguments are actually needed.

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.