Dependency not found C/C++ Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

meson.build: ERROR: Dependency "x" not found, tried pkgconfig and cmake

Meson could not locate a required library.

Exact message you may see Dependency "x" not found, tried pkgconfig and cmakemeson Dependency not foundDependency lookup for failed
Seen on: Meson Linux

Meaning

Meson tries pkg-config, CMake config files and system paths. A missing -dev package or a custom prefix not on PKG_CONFIG_PATH is the cause.

Common causes

  • Development package not installed
  • .pc file in a non-standard folder
  • Version constraint not met
  • Cross-compile without a cross pkg-config

⚡ Quick fix

  1. Install the -dev package
  2. Set PKG_CONFIG_PATH
  3. Check the version required in dependency('x', version: '>=1.2')

Detailed fix by platform

Shell

  1. pkg-config --modversion x and meson setup build --reconfigure

How to diagnose

  1. pkg-config — Finds it?
  2. Version — Meets requirement?
  3. Prefix — Custom path?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

C compiler cannot create executables — configure: error: C compiler cannot create executables / no acceptable C compiler found in $PATH (C/C++)C compiler cannot cre…cgo: C compiler gcc not found — Go: cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH (Go)cgo: C compiler gcc n…Could not find a package configuration file — CMake Error: Could not find a package configuration file provided by "Foo" (requested version 1.2) (C/C++)Could not find a pack…does not appear to contain CMakeLists.txt — CMake Error: The source directory does not appear to contain CMakeLists.txt (C/C++)does not appear to co…Error 1 — make: *** [Makefile:12: target] Error 1 — a recipe command failed (C/C++)Error 1fatal error: No such file or directory — C/C++: fatal error: foo.h: No such file or directory — #include not found (C/C++)fatal error: No such …function main is undeclared in the main package — Go: runtime.main_main·f: function main is undeclared in the main package (Go)function main is unde…Killed signal terminated program cc1plus — g++: fatal error: Killed signal terminated program cc1plus — compilation terminated (out of memory) (C/C++)Killed signal termina…Dependenc…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.