Skip to content

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

@tathougies

Description

@tathougies

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 <glib.h> / <gobject.h> 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions