Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have been installing a bunch of libraries lately from the GNOME sources on Mac. They use pkg-config.

Every time I run a configure, it complains that it can't find library XYZ, which I installed to /usr/local/lib. The only way I can complete the configure process is to reinstall the packages using MacPorts.

How can I get pkg-config to see the default /usr/local/lib? Setting PKG_CONFIG_PATH doesn't seem to work.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

I figured this out. Apparently packages that use pkg-config create a .pc file in the highest-level directory that is created after untaring source code for library Y.

Then, if library Z complains that it cannot find library Y, and it uses pkg-config, set the PKG_CONFIG_PATH variable to point to the .pc file.

In my case, libxml++ relies on libxml2, so when configuring libxml++, I have to point the path to the .pc file created by libxml2:

export PKG_CONFIG_PATH=/Users/ryan/SVN/packages/libxml2-2.7.3/libxml2.pc

Then configure works correctly.

share|improve this answer
    
strange how that would work as .pc is a file, not a path? however it that works for then great. Stuart –  stuart Brand Jul 24 '09 at 19:31
    
Actually the correct notation is to provide the containing directory, not the filename itself. –  ypnos May 18 '10 at 13:48

you have to set PKG_CONFIG_PATH to exactly where the library is, such as xyz.so is not in /usr/lib but /usr/lib/xyz so you need to extend the path to include it...

export PKG_CONFIG_PATH = $PKG_CONFIG_PATH:/usr/lib/xyz

Stuart

share|improve this answer
    
Ugh. So if there are multiple such libraries, I would need to specify the path to each of these libraries individually? –  Ryan Rosario Jul 24 '09 at 17:55
    
Yes. On a typical unix systems user would install all their custom libraries to one single location, like /usr/local/ or ~/lib. Then pkgconfig would be more convenient to use ;) –  ypnos May 18 '10 at 13:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.