Pkg-config cannot find .pc files, although they are in the path

I see a strange problem with pkg-config on Mac OSX-Lion. When I run the python setup for a loaded module, I get the following error:

aspen:python toddysm$ sudo ./setup.py install Password: `pkg-config --libs --cflags cld` returns in error: Package cld was not found in the pkg-config search path. Perhaps you should add the directory containing `cld.pc' to the PKG_CONFIG_PATH environment variable No package 'cld' found The `cld` C++ library is absent from this system. Please install it. 

However, when checking in the / usr / local / lib folder, I see that the libs and the .pc file are in the pkgconfig subfolder

 aspen:~ toddysm$ cd /usr/local/lib/ aspen:lib toddysm$ ls -al total 2640 drwxr-xr-x 6 root wheel 204 Jul 2 17:38 . drwxr-xr-x 9 root wheel 306 Jul 2 15:17 .. -rwxr-xr-x 1 root wheel 1339516 Jul 2 17:38 libcld.0.dylib lrwxr-xr-x 1 root wheel 14 Jul 2 17:38 libcld.dylib -> libcld.0.dylib -rwxr-xr-x 1 root wheel 918 Jul 2 17:38 libcld.la drwxr-xr-x 3 root wheel 102 Jul 2 17:38 pkgconfig aspen:lib toddysm$ cd pkgconfig/ aspen:pkgconfig toddysm$ ls -al total 8 drwxr-xr-x 3 root wheel 102 Jul 2 17:38 . drwxr-xr-x 6 root wheel 204 Jul 2 17:38 .. -rw-r--r-- 1 root wheel 279 Jul 2 17:38 cld.pc 

Setting PKG_CONFIG_PATH to point to / usr / local / lib / using the command line does not help. Setting it to ~ / .bash_profile for some reason makes pkg-config unrecognizable as a command.

My guess is that I'm missing some dependency, but not sure what. When trying to use the same thing on Linux, I was missing the Python Dev package python2.7-dev, but I'm not sure how to test this on a Mac (whether it is or not).

Any help would be appreciated.

+7
source share
3 answers

By default, you can view the pkg-config directories using:

 pkg-config --variable pc_path pkg-config 

PKG_CONFIG_PATH requires the full path /usr/local/lib/pkgconfig to the variable.

+19
source

Environment variables must be export to be useful for commands. Try

 $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig $ pkg-config --libs --cflags cld 
+8
source

It seems that although PKG_CONFIG_PATH was installed correctly, the Python script did not compile it. Looking at the script, it runs pkg-config in the subprocess, and I'm not sure if the environment variable information is passed to the subprocess. However, I solved the problem by copying the libraries and the .cp file to / opt / local / lib /, which is the default folder in which pkg-config looks like.

+1
source

All Articles