0

When I try to

cabal install ihaskell-diagrams

I get the error

The pkg-config package 'glib-2.0' is required but it could not be found.

What is glib and how do I install it so that it is available for Cabal?


Resolving dependencies...
Configuring cairo-0.13.1.0...
Configuring glib-0.13.2.1...
Failed to install cairo-0.13.1.0
Build log ( /Users/Rax/.cabal/logs/cairo-0.13.1.0.log ):
[1 of 2] Compiling SetupWrapper     ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/Main.o )
Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring cairo-0.13.1.0...
setup: The pkg-config package 'cairo' version >=1.2.0 is required but it could
not be found.
Failed to install glib-0.13.2.1
Build log ( /Users/Rax/.cabal/logs/glib-0.13.2.1.log ):
[1 of 2] Compiling SetupWrapper     ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/Main.o )

Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.13.2.1...
setup: The pkg-config package 'glib-2.0' is required but it could not be
found.
cabal: Error: some packages failed to install:
cairo-0.13.1.0 failed during the configure step. The exception was:
ExitFailure 1
diagrams-cairo-1.3.0.5 depends on glib-0.13.2.1 which failed to install.
glib-0.13.2.1 failed during the configure step. The exception was:
ExitFailure 1
ihaskell-diagrams-0.3.1.0 depends on glib-0.13.2.1 which failed to install.
pango-0.13.1.0 depends on glib-0.13.2.1 which failed to install.
orome
  • 45,163
  • 57
  • 202
  • 418
  • 2
    *gilb* and *cairo* are part of the GTK+ toolkit; as that is a non-Haskell dependency you need to install it in your system separately (I don't know what is the most convenient way of doing that in OSX). – duplode Oct 04 '15 at 20:23
  • On OS X you can install it using homebrew – Abizern Oct 04 '15 at 21:51
  • 3
    I don't understand why this question got downvoted. – ErikR Oct 04 '15 at 23:00
  • Because the author obviously didn't even attempt to do any research on their own. A simple Google search for "glib" would have told them what it is, and "glib osx" would have told them how to install it on OS X (the second result for me is a SO post which suggests `brew install glib`). – nemequ Oct 05 '15 at 08:07
  • @nemequ: My bad. The searches I did (obviously not?) do — "haskell glib", "cabal glib", etc. — yielded no useful (and sometimes confusing) results. – orome Oct 05 '15 at 11:50
  • There are [detailed instructions for installing Gtk2Hs](https://wiki.haskell.org/Gtk2Hs/Installation), including a page [specifically devoted to OSX](https://wiki.haskell.org/Gtk2Hs/Mac). – Daniel Wagner Oct 06 '15 at 00:26
  • @DanielWagner: That would make an accepted answer if elaborated a bit. – orome Oct 12 '15 at 18:41
  • @raxacoricofallapatorius I won't do that, because I don't have a Mac and I can't verify what's actually worked for me. But it's perfectly good etiquette to answer your own question once you've discovered something that works -- so I say write up the answer you'd accept, and accept it! – Daniel Wagner Oct 12 '15 at 18:48

1 Answers1

1

The confusion here results from the perhaps unclear error message: the missing components are not Cabal packages, but libraries that need to be separately installed.

Some of these libraries have their own dependencies, or installing them may reveal additional missing packages, so that the specific requirements on your system my be different; but in general, when you get an error that a "pig-config package" is missing, you will need to install it with your package manager (not Cabal).

For example,

brew install glib
brew install cairo
brew install pango

work for me and allow me to

cabal install ihaskell-diagrams

without further errors.

orome
  • 45,163
  • 57
  • 202
  • 418