Skip to content

Cabal 3.8 checks for literally all pkg-config packages in the system #8494

Closed
@arrowd

Description

@arrowd

Describe the bug
When the .cabal package being built contains pkgconfig-depends, the cabal-install tool checks for every pkg-config package installed. If any of these packages are broken for some reason the build fails even if the Cabal package doesn't use it.

To Reproduce
Find out which directories are searched by pkg-config:

% pkg-config --variable pc_path pkg-config
/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig:/usr/local/share/pkgconfig

Create an invalid aaa.pc package description for pkg-config in one of those dirs:

Name: aaa
Version: 123
Description: asdasd

Requires: asdasd

Trying to get an information for this package will result in error:

% pkg-config --modversion aaa
Package asdasd was not found in the pkg-config search path.
Perhaps you should add the directory containing `asdasd.pc'
to the PKG_CONFIG_PATH environment variable
Package 'asdasd', required by 'aaa', not found

Now try to build any Cabal package with pkgconfig-depends:

cabal unpack gi-atk
cd gi-atk-2.0.24
cabal build --dry-run -v2

It fails claiming that gi-atk.pc wasn't found even if it is installed:

Error: cabal: Could not resolve dependencies:
[__0] next goal: gi-atk (user goal)
[__0] rejecting: gi-atk-2.0.24 (conflict: pkg-config package atk>=2.0 && <3,
not found in the pkg-config database)

Expected behavior
Package configuration should be successful since the package isn't using aaa.

System information

  • FreeBSD 14-CURRENT
  • cabal 3.8.1.0
  • ghc 9.2.4

Additional context
#8446

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions