CMake "pkg-config not found" / PKG_CONFIG_EXECUTABLE-NOTFOUND in CI
find_package(PkgConfig) and pkg_check_modules need the pkg-config (or pkgconf) executable. On a slim CI image it is often missing, so the probe reports NOTFOUND.
What this error means
Configure fails because PKG_CONFIG_EXECUTABLE is NOTFOUND, or pkg_check_modules cannot locate a module, on an image without pkg-config installed.
cmake
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:99 (message):
pkg-config tool not foundCommon causes
How to fix it
Install pkg-config
- Install the pkg-config (or pkgconf) package before configuring.
- Set PKG_CONFIG_PATH if the .pc files live in a custom prefix.
cmake
apt-get install -y pkg-config
export PKG_CONFIG_PATH=/opt/lib/pkgconfigHow to prevent it
- Install pkg-config in the runner image and set PKG_CONFIG_PATH for any dependency whose .pc files sit outside the default search path.