Many C libraries reported as ‘Missing (or bad)’
For at least the past few months I have been completely unable to build libraries such as gi-gtk
or sdl2
. When I try, I get errors such as:
Failed to build haskell-gi-base-0.26.0. The failure occurred during the
configure step.
Build log (
C:\cabal\logs\ghc-8.10.7\haskell-gi-ba_-0.26.0-05595a76c088c4f1280525f85c785f38ae565b6f.log
):
Configuring library for haskell-gi-base-0.26.0..
cabal-3.6.2.0.exe: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: gobject-2.0, glib-2.0, intl
And:
Failed to build sdl2-2.5.3.3. The failure occurred during the configure step.
Build log (
C:\cabal\logs\ghc-9.2.4\sdl2-2.5.3.3-adf42d32532325aef6b305167fc7282217d16fa3.log
):
Configuring library for sdl2-2.5.3.3..
cabal-3.6.2.0.exe: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: SDL2, mingw32, SDL2main, SDL2
Based on prior discussions in /r/haskell, I suspect the culprit is related to #371 (closed)… except that issue has been fixed in my GHCup, so that can’t be it.
Curiously, however, whereas Cabal 3.6.2.0 gave the errors supplied above, Cabal 3.8.1.0 gives quite different error messages, at dependency-resolution time rather than compile time; e.g.:
$ cabal-3.8.1.0.exe run test.hs
Error: cabal-3.8.1.0.exe: Could not resolve dependencies:
[__0] trying: fake-package-0 (user goal)
[__1] next goal: gi-cairo (dependency of fake-package)
[__1] rejecting: gi-cairo-1.0.26, gi-cairo-1.0.25, gi-cairo-1.0.24,
gi-cairo-1.0.23, gi-cairo-1.0.22, gi-cairo-1.0.21, gi-cairo-1.0.20,
gi-cairo-1.0.19, gi-cairo-1.0.17, gi-cairo-1.0.16, gi-cairo-1.0.15,
gi-cairo-1.0.14, gi-cairo-1.0.13, gi-cairo-1.0.12, gi-cairo-1.0.11,
gi-cairo-1.0.10, gi-cairo-1.0.9, gi-cairo-1.0.8, gi-cairo-1.0.7,
gi-cairo-1.0.6, gi-cairo-1.0.5, gi-cairo-1.0.4, gi-cairo-1.0.3,
gi-cairo-1.0.2, gi-cairo-1.0.1 (conflict: pkg-config package
cairo-gobject>=1.0 && <2, not found in the pkg-config database)
[__1] rejecting: gi-cairo-0.1.14.15, gi-cairo-0.1.14.14, gi-cairo-0.1.14.13,
gi-cairo-0.1.14.12, gi-cairo-0.1.14.11, gi-cairo-0.1.14.10, gi-cairo-0.1.14.9,
gi-cairo-0.1.14.8 (conflict: pkg-config package cairo-gobject>=1.14, not found
in the pkg-config database)
[__1] fail (backjumping, conflict set: fake-package, gi-cairo)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: gi-cairo, base, fake-package
Either way, there’s obviously something wrong with the way GHC or Cabal is looking for packages in the pkg-config database maintained by GHCup’s MSYS/MinGW.
For reference, I’m on Windows 10, and using GHCup 0.1.18.0 (the latest version I can get).