Pkg-config does not respect PKG_CONFIG_PATH


(Marcin Skoczylas) #1

Hello,

I need working pkg-config with my own list of folders for ARM cross development. I installed it via HomeBrew, changed the PKG_CONFIG_PATH but it seems pkg-config does not use the PKG_CONFIG_PATH environment variable at all. Maybe I’m misunderstanding something, or doing something wrong? How I can make pkg-config look into my selected folders?

[mars@mbp]:~/develop/rp3> echo $PKG_CONFIG_PATH 
/Volumes/xtools/opt/lib/pkgconfig
[mars@mbp]:~/develop/rp3> pkg-config --variable pc_path pkg-config
/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12

(Joshua McKinney) #2

Homebrew doesn’t modify the upstream source, which should respect the environment variable you mentioned. Looking into this, the command you’re running doesn’t seem to do what you think it does. It shows the builtin fallback paths not your environment overrides.

See https://github.com/Homebrew/homebrew-core/blob/master/Formula/pkg-config.rb and https://cgit.freedesktop.org/pkg-config/tree/main.c#n520


(Sean De Nigris) #3

I am having a similar problem, but IIUC I correctly set PKG_CONFIG_PATH…

From config.log:

configure:13214: checking for GStreamer
configure:13224: $PKG_CONFIG --exists --print-errors “gstreamer-$GST_MAJORMINOR >= 1.0
gstreamer-base-$GST_MAJORMINOR >= 1.0
gstreamer-plugins-base-$GST_MAJORMINOR >= 1.0”
Package gstreamer-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing gstreamer-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gstreamer-1.0' found Package gstreamer-base-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containinggstreamer-base-1.0.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘gstreamer-base-1.0’ found
Package gstreamer-plugins-base-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-plugins-base-1.0.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘gstreamer-plugins-base-1.0’ found

What makes this bizzare is that the offending line works perfectly from a terminal:

pkg-config --exists --print-errors “gstreamer-1.0”

I should also mention that I tried to use the full path to pkg-config listed earlier in config.log as a sanity check, namely:

/usr/local/opt/pkg-config/bin/pkg-config

Also, I did a debug run of pkg-config to see where it was finding gstreamer:

pkg-config --debug --libs gstreamer-1.0

I then added the appropriate directory via:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

And reinstalled pocketsphinx via:

brew uninstall cmu-pocketsphinx
brew uninstall cmu-sphinxbase
brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxbase
brew install --HEAD watsonbox/cmu-sphinx/cmu-pocketsphinx

But the config.log still reported not finding gstreamer :confused:

Notes:


(Steve Peters) #4

Have you tried building with --env=std? That’s not usually recommended but I think brew overwrites the PKG_CONFIG_PATH variables with --env=super (the default).