Skip to content

cabal fails to use pkg-config for dependency resolution on linux #9790

Closed
@pakanek

Description

@pakanek

Describe the bug
Cabal is unable resolve dependencies because of not being able to use pkg-config.

To Reproduce

$ cabal init bug -n
$ cd bug

add gi-glib >=2.0 && <3.0 to build-depends in cabal file

$ cabal build
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] next goal: bug (user goal)
[__0] rejecting: bug-1.0.1, bug-1 (constraint from user target requires
==0.1.0.0)
[__0] trying: bug-0.1.0.0
[__1] next goal: gi-glib (dependency of bug)
[__1] rejecting: gi-glib-2.0.29, gi-glib-2.0.27, gi-glib-2.0.26,
gi-glib-2.0.25, gi-glib-2.0.24, gi-glib-2.0.23, gi-glib-2.0.22,
gi-glib-2.0.21, gi-glib-2.0.20, gi-glib-2.0.19, gi-glib-2.0.17,
gi-glib-2.0.16, gi-glib-2.0.15, gi-glib-2.0.14, gi-glib-2.0.13,
gi-glib-2.0.12, gi-glib-2.0.11, gi-glib-2.0.10, gi-glib-2.0.9, gi-glib-2.0.8,
gi-glib-2.0.7, gi-glib-2.0.6, gi-glib-2.0.5, gi-glib-2.0.4, gi-glib-2.0.3,
gi-glib-2.0.2, gi-glib-2.0.1 (conflict: pkg-config package glib-2.0-any, not
found in the pkg-config database)
[__1] rejecting: gi-glib-0.2.46.15 (conflict: bug => gi-glib>=2.0 && <=3.0)
[__1] skipping: gi-glib-0.2.46.14, gi-glib-0.2.46.13, gi-glib-0.2.46.12,
gi-glib-0.2.44.12, gi-glib-0.0.2.2, gi-glib-0.0.2.1, gi-glib-0.0.2,
gi-glib-0.2.46.10, gi-glib-0.2.44.11, gi-glib-0.2.44.10, gi-glib-0.2.44.9,
gi-glib-0.2.44.8 (has the same characteristics that caused the previous
version to fail: excluded by constraint '>=2.0 && <=3.0' from 'bug')
[__1] fail (backjumping, conflict set: bug, gi-glib)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: gi-glib, bug

Expected behavior
Use pkg-config provided by the OS.

System information

  • Linux, Fedora 39
  • cabal-install version 3.10.1.0
  • compiled using version 3.10.1.0 of the Cabal library
  • The Glorious Glasgow Haskell Compilation System, version 9.8.1

Additional context
By default Fedora has package glib-2.0, so I thought maybe creating symlink named glib-2.0-any would help, but it did not.

$ pkg-config --libs --cflags glib-2.0-any
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -pthread -lglib-2.0
$ ls -l /usr/lib64/pkgconfig/glib-2.0-any.pc 
lrwxrwxrwx. 1 root root 11 Mar  8 22:50 /usr/lib64/pkgconfig/glib-2.0-any.pc -> glib-2.0.pc
$ pkg-config --list-all | grep glib-2.0
glib-2.0                       GLib - C Utility Library
glib-2.0-any                   GLib - C Utility Library

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions