Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pkg-config and OSX 10.8, proper PKG_CONFIG_PATH? Missing .pc files?

Tags:

I installed pkg-config with homebrew in OSX. I'm not sure what I should set my PKG_CONFIG_PATH to? Should it be a combination of /usr/include and /usr/local/include? Even if I use one or the other, I get an error about there not being any .pc files, which I take it would contain info used by pkg-config? Not sure what I'm doing wrong. Help appreciated.

$ pkg-config --libs libxml2   Package libxml2 was not found in the pkg-config search path.   Perhaps you should add the directory containing `libxml2.pc'   to the PKG_CONFIG_PATH environment variable   No package 'libxml2' found 

Update: So maybe I'm asking two different questions. I just curled gsl and ran through the ./configure && make && sudo make install. And with an empty $PKG_CONFIG_PATH I actually got a hit with:

pkg-config --libs gsl   -L/usr/local/lib -lgsl -lgslcblas -lm 

But listing /usr/local/lib shows the gsl libs but no .pc files. How come pkg-config works for custom installed packages in OSX but not default installed ones???

like image 874
Nick Desaulniers Avatar asked Aug 28 '12 23:08

Nick Desaulniers


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 Mac?

pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use gcc -o test test.

What is a pkg-config file?

Introduction. pkg-config is a useful tool for making sure compiler options are correct when compiling and linking software. Very often with compilers, you will need to determine the proper paths to library header files and code in order to link them to your software project.


1 Answers

echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib" >> ~/.bashrc && source ~/.bashrc

to test with say glib:

brew install glib && pkg-config --libs --cflags glib-2.0 

should get you the goods:

-I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.2/include  -L/usr/local/Cellar/glib/2.34.3/lib -L/usr/local/Cellar/gettext/0.18.2/lib -lglib-2.0 -lintl 
like image 187
Nick Desaulniers Avatar answered Oct 14 '22 22:10

Nick Desaulniers