Cabal, xmonad-contrib, X11-xft, pkg-config ... questioning my sanity

In short: I can't cabal install xmonad-contrib. Longer version: It a appears that a program which does not exist on my computer seems to insist on a package version which does not exist in my universe, I'm starting to wonder whether I have lost my marbles. Could some kind soul please point me in some sensible direction? cabal install xmonad-contrib Resolving dependencies... Configuring X11-xft-0.3... cabal: pkg-config version >=0.9.0 is required but it could not be found. cabal: Error: some packages failed to install: X11-xft-0.3 failed during the configure step. The exception was: ExitFailure 1 xmonad-contrib-0.9.1 depends on X11-xft-0.3 which failed to install. cabal install x11-xft Resolving dependencies... Configuring X11-xft-0.3... cabal: pkg-config version >=0.9.0 is required but it could not be found. cabal: Error: some packages failed to install: X11-xft-0.3 failed during the configure step. The exception was: ExitFailure 1 X11-xft version 0.9.0 doesn't even exist, as far a I can tell: 0.3 seems to be the highest. So what is making cabal believe that such a version is needed? Is it pkg-config? I'm not at all familiar with pkg-config, and, as far as I can tell it's not even installed on the Mac on which I am trying to do this. Curiously, its man page *does* work (it's in /usr/X11/man, for some reason). Does Cabal have some sort of embedded pkg-config?

On 6 December 2010 11:02, Jacek Generowicz
It a appears that a program which does not exist on my computer seems to insist on a package version which does not exist in my universe, I'm starting to wonder whether I have lost my marbles. Could some kind soul please point me in some sensible direction?
cabal install xmonad-contrib Resolving dependencies... Configuring X11-xft-0.3... cabal: pkg-config version >=0.9.0 is required but it could not be found.
X11-xft version 0.9.0 doesn't even exist, as far a I can tell
In the development version of cabal we have changed that error message to try and make it clear that it is looking for a program called pkg-config, not a Haskell package or a C lib. cabal: The program pkg-config version >=0.9.0 is required but it could not be found. Do you think that message would have helped avoid your confusion? Is there an alternative message that would have been better? pkg-config [1] is a tool used by C libraries to describe things like dependencies on other C libs and what C compiler flags are needed to use the packages. The Haskell package X11-xft is a binding to the C library xft. On most modern unix systems xft C library provides meta-data that pkg-config can use. For example, on my system I can run: $ pkg-config --cflags xft -I/usr/include/freetype2 $ pkg-config --libs xft -lXft -lXrender -lfontconfig -lfreetype -lX11 Cabal does exactly the same thing, to work out what flags are needed to use the xft C library. The problem on your system is that the pkg-config program is not installed. Perhaps on OSX it comes with Xcode, I'm not sure. It may well also be the case that you don't have the development files for X11 or xft installed either (e.g. C header files). Hopefully some OSX person can advise you on what you need to install to do X11 development on OSX. [1]: http://pkg-config.freedesktop.org/wiki/ Duncan

On Mon, Dec 6, 2010 at 7:15 AM, Duncan Coutts
On 6 December 2010 11:02, Jacek Generowicz
wrote: It a appears that a program which does not exist on my computer seems to insist on a package version which does not exist in my universe, I'm starting to wonder whether I have lost my marbles. Could some kind soul please point me in some sensible direction?
cabal install xmonad-contrib Resolving dependencies... Configuring X11-xft-0.3... cabal: pkg-config version >=0.9.0 is required but it could not be found.
X11-xft version 0.9.0 doesn't even exist, as far a I can tell
In the development version of cabal we have changed that error message to try and make it clear that it is looking for a program called pkg-config, not a Haskell package or a C lib.
cabal: The program pkg-config version >=0.9.0 is required but it could not be found.
Do you think that message would have helped avoid your confusion? Is there an alternative message that would have been better?
pkg-config [1] is a tool used by C libraries to describe things like dependencies on other C libs and what C compiler flags are needed to use the packages.
The Haskell package X11-xft is a binding to the C library xft. On most modern unix systems xft C library provides meta-data that pkg-config can use. For example, on my system I can run:
$ pkg-config --cflags xft -I/usr/include/freetype2
$ pkg-config --libs xft -lXft -lXrender -lfontconfig -lfreetype -lX11
Cabal does exactly the same thing, to work out what flags are needed to use the xft C library.
The problem on your system is that the pkg-config program is not installed. Perhaps on OSX it comes with Xcode, I'm not sure. It may well also be the case that you don't have the development files for X11 or xft installed either (e.g. C header files). Hopefully some OSX person can advise you on what you need to install to do X11 development on OSX.
On my Mac 'which -a pkg-config' returns: /opt/local/bin/pkg-config /opt/local/bin/pkg-config I'm not sure why it prints twice. The folder means I've installed it from MacPorts, which also means I guess you'll need to install the MacPorts version of X11-xft, but I'm not sure. However building Haskell libraries against MacPorts often leads to nightmarish scenarios involving libiconv, but I haven't run into that on my current installation yet. Antoine
[1]: http://pkg-config.freedesktop.org/wiki/
Duncan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 2010 Dec 6, at 15:05, Antoine Latter wrote:
On my Mac 'which -a pkg-config' returns: /opt/local/bin/pkg-config /opt/local/bin/pkg-config
I'm not sure why it prints twice.
Same happens with my hand-installed version when I use the -a flag: it only shows it once when invoked without -a.

Problem solved: 2 solutions described below. On 2010 Dec 6, at 14:15, Duncan Coutts wrote:
On 6 December 2010 11:02, Jacek Generowicz
wrote: It a appears that a program which does not exist on my computer seems to insist on a package version which does not exist in my universe, I'm starting to wonder whether I have lost my marbles. Could some kind soul please point me in some sensible direction?
cabal install xmonad-contrib Resolving dependencies... Configuring X11-xft-0.3... cabal: pkg-config version >=0.9.0 is required but it could not be found.
X11-xft version 0.9.0 doesn't even exist, as far a I can tell
In the development version of cabal we have changed that error message to try and make it clear that it is looking for a program called pkg-config, not a Haskell package or a C lib.
cabal: The program pkg-config version >=0.9.0 is required but it could not be found.
Do you think that message would have helped avoid your confusion?
=0.9.0 is required but could not be found"), I have no idea whether
Oooh, that's a difficult question to answer, as I had read your earlier paragraph before coming to this question. After your explanation explained the error message (to the extent that I now wonder how on earth I ever took it to mean that it's looking for X11- xft version >=0.9.0, when it quite clearly states "pkg-config version the new message would have been better.
Is there an alternative message that would have been better?
Well, if I try to understand how I could have misunderstood the original message, I suspect that it is because of the common style of error message where the program generating the message precedes the actual message on the same line, just like "cabal: ..." precedes the message in this case. So I guess that I parsed it something like "... pkg-config: version >=0.9.0 is required ..." and inferred that 'version' refers to the package mentioned in an earlier message. In which case, maybe something like cabal: version >=0.9.0 of pkg-config is required ... would have prevented me from making this particular mistake in this particular case.
pkg-config [1] is a tool used by C libraries to describe things like dependencies on other C libs and what C compiler flags are needed to use the packages.
The Haskell package X11-xft is a binding to the C library xft. On most modern unix systems xft C library provides meta-data that pkg-config can use. For example, on my system I can run:
$ pkg-config --cflags xft -I/usr/include/freetype2
$ pkg-config --libs xft -lXft -lXrender -lfontconfig -lfreetype -lX11
Cabal does exactly the same thing, to work out what flags are needed to use the xft C library.
The problem on your system is that the pkg-config program is not installed. Perhaps on OSX it comes with Xcode, I'm not sure. It may well also be the case that you don't have the development files for X11 or xft installed either (e.g. C header files). Hopefully some OSX person can advise you on what you need to install to do X11 development on OSX.
Solution 1 (more complicated version): Although I never use XCode itself, I thought that I had it installed along with all the developer tools in order to get at GCC etc. Apparently not. Anyway, pkg-config seems to be available through darwinports, but I don't use darwinports (as, many years ago, I concluded that it's more trouble than it's worth, because of the strange places where it puts the stuff it manages). However, a plain manual compilation Just Works (for me): curl http://pkgconfig.freedesktop.org/releases/pkg-config-0.25.tar.gz -o pkgconfig.tgz tar zxf pkgconfig.tgz cd pkgconfig.tgz ./configure make sudo make install and I now have pkg-config If I try pkg-config --cflags xft it complains about the package not being found, and mentions the relevant environment variable. I *do* have /usr/X11/lib/pkgconfig/xft.pc, and popping its directiory into PKG_CONFIG_PATH makes the above pkg-config call now work. In this state, cabal install xmonad-contrib also works. = = = ======================================================================== Solution 2 (simpler): I did manage to get xmonad-contrib to cabal install (without pkg- config) by asking for it not to use xft cabal install xmonad-contrib --flags="-use_xft" Presumably cabal uses pkg-config for only a subset of the things it manages, and xft is the only one of those on which xmonad-contrib depends. Thank you Duncan for your concise, clear and complete answer: it was just what I needed to unblock me.

On 2010 Dec 6, at 15:39, Jacek Generowicz wrote:
On 2010 Dec 6, at 14:15, Duncan Coutts wrote:
In the development version of cabal we have changed that error message to try and make it clear that it is looking for a program called pkg-config, not a Haskell package or a C lib.
cabal: The program pkg-config version >=0.9.0 is required but it could not be found.
Do you think that message would have helped avoid your confusion?
Oooh, that's a difficult question to answer, as I had read your earlier paragraph before coming to this question. After your explanation explained the error message (to the extent that I now wonder how on earth I ever took it to mean that it's looking for X11- xft version >=0.9.0, when it quite clearly states "pkg-config version >=0.9.0 is required but could not be found"), I have no idea whether the new message would have been better.
Is there an alternative message that would have been better?
Well, if I try to understand how I could have misunderstood the original message, I suspect that it is because of the common style of error message where the program generating the message precedes the actual message on the same line, just like "cabal: ..." precedes the message in this case. So I guess that I parsed it something like "... pkg-config: version >=0.9.0 is required ..." and inferred that 'version' refers to the package mentioned in an earlier message.
In which case, maybe something like
cabal: version >=0.9.0 of pkg-config is required ...
would have prevented me from making this particular mistake in this particular case.
Another thing that would probably have made it easier to understand: the message is strictly correct, but is *too* specific: it talks about pkg-config version >=0.9.0 not being found, while the problem was that *no version at all* was present. I would understand if making the error message change according to such subtle distinctions would be more effort that it is worth.

On 6 December 2010 14:48, Jacek Generowicz
Another thing that would probably have made it easier to understand: the message is strictly correct, but is *too* specific: it talks about pkg-config version >=0.9.0 not being found, while the problem was that *no version at all* was present.
I would understand if making the error message change according to such subtle distinctions would be more effort that it is worth.
Yes. The version is there so that when you do go and install it, you will know what version to look for, so you don't end up in the situation where you've gone to all the effort of installing pkg-config, only to find it now complains that it found it, but it was too old. Perhaps something like this would be better: cabal: The program 'pkg-config' is required but it could not be found on the system (version 0.9.0 or later of pkg-config is required). Duncan

On 2010 Dec 6, at 16:25, Duncan Coutts wrote:
Perhaps something like this would be better:
cabal: The program 'pkg-config' is required but it could not be found on the system (version 0.9.0 or later of pkg-config is required).
That looks pretty good. I'm having trouble finding any holes in it. There is also the issue (if my understanding is correct) that cabal install only needs pkg-config for some packages. So it is possible that someone has happily been using cabal install for some time, and then suddenly it doesn't work. And then they are left wondering what broke: "But I'm sure it worked last week, and I haven't changed anything" etc. At which point it could be helpful to be told that it's a circumstantial rather than a fundamental problem.
participants (4)
-
Antoine Latter
-
Duncan Coutts
-
Jacek Generowicz
-
Simon Michael