[Haskell-cafe] Cabal, xmonad-contrib, X11-xft, pkg-config ... questioning my sanity

Jacek Generowicz jacek.generowicz at cern.ch
Mon Dec 6 15:39:26 CET 2010


Problem solved: 2 solutions described below.


On 2010 Dec 6, at 14:15, Duncan Coutts wrote:

> On 6 December 2010 11:02, Jacek Generowicz  
> <jacek.generowicz at cern.ch> 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?

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.

> 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.




More information about the Haskell-Cafe mailing list