Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am seeing a strange issue with pkg-config on Mac OSX-Lion. When running the python setup for module that I downloaded I receive 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 the libs and the .pc file is 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 doesn't help. Setting it into ~/.bash_profile for some reason makes pkg-config unrecognizable as command.

My assumption is that I am missing some dependency but not sure what. When trying the same on Linux I was missing the Python Dev package python2.7-dev but I am not sure how to check for this on Mac (whether is there or not).

Any help will be appreciated.

like image 840
toddysm Avatar asked Jul 03 '12 02:07

toddysm


People also ask

Where are pkg-config files located?

On most systems, pkg-config looks in /usr/lib/pkgconfig , /usr/share/pkgconfig , /usr/local/lib/pkgconfig and /usr/local/share/pkgconfig for these files. It will additionally look in the colon-separated (on Windows, semicolon-separated) list of directories specified by the PKG_CONFIG_PATH environment variable.

What is pkg-config -- cflags?

pkg-config uses configuration files (defined by the libraries) to generate the above information for compilers, and allows us to not worry about what operating system or distribution the compilation takes place on. --cflags means the pkg-config should give the compilation flags for the listed packages.

What is .PC file Linux?

Information stored by . pc files include compiler and linker flags necessary to use a given library, as well as any other relevant metadata. These . pc files are processed by a utility called pkg-config, of which pkgconf is an implementation. FILE SYNTAX The .


2 Answers

You can list the directories pkg-config looks in by default using:

pkg-config --variable pc_path pkg-config

PKG_CONFIG_PATH needs the full /usr/local/lib/pkgconfig pathname appended to the variable.

like image 192
Brett Hale Avatar answered Oct 11 '22 21:10

Brett Hale


Environment variables need to be export'ed to be useful for commands. Try

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ pkg-config --libs --cflags cld
like image 21
Yasushi Shoji Avatar answered Oct 11 '22 21:10

Yasushi Shoji