Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.96k stars 11.34k forks source link

document pkg-config configuration #21129

Closed hhugo closed 8 years ago

hhugo commented 11 years ago

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 commented 11 years ago

Can you elaborate?

hhugo commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

I see. It maybe requires more documentation then.

mietek commented 10 years ago

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 commented 10 years ago

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

fish2000 commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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.