Search code examples
meson-buildpkg-config

meson ignore PKG_CONFIG_PATH in parent shell and meson.build?


(meson 1.5.1)
I want meson to use pkgconfig file from a custom location.
Of course, set PKG_CONFIG_PATH and runn pkg-config in shell is fine.

meson-log.txt

Determining dependency 'xxx' with pkg-config executable '/usr/bin/pkg-config'
env[PKG_CONFIG_PATH]: 
env[PKG_CONFIG]: /usr/bin/pkg-config
-----------
Called: `/usr/bin/pkg-config --modversion xxx` -> 1
stderr:
Package libvlc4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `xxx.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xxx' found
-----------

The quoted cmdline runs fine in the shell that meson is launched.
In the log file, env[PKG_CONFIG_PATH] is always empty:

  • Set PKG_CONFIG_PATH in shell: empty
  • Add environment().append() in meson.build: empty

How to solve this problem?


Solution

  • It appears that meson is broken on pkg-config caching.
    meson setup --wipe is required to update the build after any PKG_CONFIG_PATH change (or pkg_config_path option).
    --reconfigure or --clearcache does not help.