haskell / haskell/cabal

foreign-library does not apply pkgconfig-depends cflags to c-sources when using v2-build

Open
#11,297 2 comments 0 reactions 1 assignee Claimed by @zlonast View on GitHub
re: ghc-options re: pkg-config type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

When building a `foreign-library` with `c-sources` and `pkgconfig-depends`, Cabal 3.14.1 (with GHC 9.10.1) fails to propagate the pkg-config CFLAGS (`-I/...`) to the C compiler invocation.

I'm trying to use glib, and as a result, C code that includes `` / `` etc fails to build, even though the same pkgconfig-depends works correctly for `library` and `executable` components.

**To Reproduce**

Make a cabal file with a foreign-library that uses a pkgconfig-depends library. Note that when running with `--verbose`, the files fail to build.

```
$ cabal build ...
```

**Expected behavior**

I would expect it to be the same as with library.

**System information**
- Operating system: NixOS 24.05
- `cabal`: 3.14
- `ghc`: 9.10.1

**Additional context**

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.