Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

document pkg-config configuration #21129

Closed
hhugo opened this issue Jul 10, 2013 · 9 comments
Closed

document pkg-config configuration #21129

hhugo opened this issue Jul 10, 2013 · 9 comments

Comments

@hhugo
Copy link

hhugo commented Jul 10, 2013

I had to put the following in my bashrc/bashprofile

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/X11/lib/pkgconfig/
for i in `ls /usr/local/opt/`;
do
    if [ -d "/usr/local/opt/$i/lib/pkgconfig" ];
    then export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"/usr/local/opt/$i/lib/pkgconf\
ig";
    fi;
done
@MikeMcQuaid
Copy link
Member

Can you elaborate?

@hhugo
Copy link
Author

hhugo commented Jul 11, 2013

pkg-config is not aware of all paths that brew uses so using pkg-config with (some) libs coming from brew just fail.

Brew (sometime at least) install libs in "/usr/local/opt/" and their .pc files (aka pkg-config) have path "/usr/local/opt/$(libname)/lib/pkgconfig/*.pc"
I've found other ".pc" files in /usr/X11/lib/pkgconfig/

The small script provide all the paths to pkg-config (by setting the env variable)
It could be fix automatically by brew by creating missing symlink into the directory /usr/local/lib/pkgconfig/ (this directory is already known by pkg-config)

This are the libs in "/usr/local/opt/" (with pkgconfig directory inside) I found on my computer
atk
cairo
e2fsprogs
fontconfig
freetype
fuse4x
gd
gdk-pixbuf
glib
google-perftools
gtk+
gtksourceview
harfbuzz
icu4c
imagemagick
libcroco
libevent
libffi
librsvg
libtiff
libyaml
little-cms
lua
pango
pcre
pixman
qt
ruby
sdl
sqlite
valgrind
xz

@jacknagel
Copy link
Contributor

Some things are deliberately not linked into /usr/local/lib/pkgconfig, these are keg-only formula that conflict with things already installed on the system. Everything else is linked as one would expect.

@hhugo
Copy link
Author

hhugo commented Jul 11, 2013

I see. It maybe requires more documentation then.

@mietek
Copy link
Contributor

mietek commented Aug 14, 2014

How would linking keg-only libs into /usr/local/lib/pkgconfig conflict with libs already installed on OS X? It seems to me that since a default installation of OS X does not include pkg-config at all, any program attempting to use pkg-config already depends on brewed libs.

@MikeMcQuaid
Copy link
Member

@mietek They may be picked up by stuff intending to pick up system versions instead.

@fish2000
Copy link
Contributor

For the record I, too, found pkgconfig directories containing *.pc files in the lib subdirectories of at least two installed kegs: LibTIFF and OpenEXR. Both of these are not keg-only.

Just to make sure I wasn’t working with old versions, I uninstalled both of these packages just now and reinstalled them; /usr/local/opt/${keg}/lib/pkgconfig was still where the pkg-config data wound up in both cases, poured right from the current bottles.

(I manually fixed both of these on my install by relocating the errant folders in question to /usr/local/opt/${keg}/share/pkgconfig – in both cases I could use e.g. pkg-config --exists ${pkgname} && echo "I Found It"to test that things were where pkg-config’s own configuration expects to find them.

@jacknagel
Copy link
Contributor

It's perfectly fine for there to be pkgconfig files in the lib/pkgconfig location. In fact, the vast majority of packages use that location. You should not need to move anything.

@DomT4
Copy link
Member

DomT4 commented Mar 23, 2016

I'm not sure the concept of keg_only isn't well documented enough by now to consider this still an issue.

There's also the How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies document that talks about PKG_CONFIG_PATH and touched upon in the FAQ.

I'll re-open if anyone protests, but I don't know if there's much more on our side to do here.

@DomT4 DomT4 closed this as completed Mar 23, 2016
@Homebrew Homebrew locked and limited conversation to collaborators Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants