Skip to content
Latchkey

pkg-config "No package 'x' found" in CI

pkg-config looks up a library through its .pc metadata file. "No package 'x' found" means no matching .pc file is on the pkg-config search path, typically because the library dev package is not installed or lives in a prefix not on PKG_CONFIG_PATH.

What this error means

A configure or build step fails with "Package 'x' was not found in the pkg-config search path" and "No package 'x' found", stopping before compilation or linking.

pkg-config
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'openssl' found

Common causes

The dev package that ships the .pc file is missing

The runtime library may be present, but the -dev/-devel package that installs x.pc is not, so pkg-config finds no metadata.

The .pc file is in a prefix not on PKG_CONFIG_PATH

A package manager installed the library under a custom prefix whose pkgconfig directory is not on the search path.

How to fix it

Install the dev package

Add the development package that provides the .pc file.

Terminal
sudo apt-get update
sudo apt-get install -y libssl-dev

Add the pkgconfig directory to PKG_CONFIG_PATH

Point pkg-config at the prefix where the .pc file lives.

Terminal
export PKG_CONFIG_PATH="$VCPKG_ROOT/installed/x64-linux/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --cflags --libs openssl

How to prevent it

  • Install -dev packages so their .pc files exist.
  • Set PKG_CONFIG_PATH for libraries in custom prefixes.
  • Verify with pkg-config --exists x early in the job.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →