6

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.

Ryan Rosario
  • 225
  • 2
  • 9

2 Answers2

5

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 directory which contains 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/

Then configure works correctly.

Huntro
  • 103
  • 5
Ryan Rosario
  • 225
  • 2
  • 9
2

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

stuart Brand
  • 492
  • 3
  • 11
  • 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