PKGCONF(1)
PKGCONF(1) โ General Commands Manual ๐
okay bestie, welcome to the PKGCONF(1) page, straight out of the General Commands Manual โจ this is the main character of build-dependency config and we're gonna go through it all, no skips, no skimming ๐
๐ธ NAME ๐ธ
pkgconf โ a system for configuring build dependency information ๐ฆ
โจ SYNOPSIS โจ
pkgconf [options] module ...
๐ DESCRIPTION ๐
so basically, pkgconf goes and fetches configuration info that's related to the module arguments you hand it, pulling from the pc(5) files installed on the system, and then it prints out whichever parts of that retrieved info match the options you asked for ๐ the most common use is printing the compiler and linker flags you need to build software that uses the libraries given by the module arguments. that's the whole point, that's the assignment ๐
when it's printing compiler and linker flags, pkgconf escapes shell metacharacters โ think quotes, whitespace, brackets, braces and glob characters โ in each fragment by putting a backslash in front of them ๐ซ the output is meant to be re-tokenised by the consumer using POSIX shell word-splitting rules, the way build systems generally do; under those rules the protective backslashes get stripped and the original values come back ๐
ngl this next bit matters: if you paste the output directly into an unquoted command substitution, like cc $(pkgconf --libs foo), that performs word-splitting and pathname expansion but it does not remove the backslashes ๐ญ so a value containing characters like that can reach the toolchain with the escaping still sitting there. not the vibe you want.
the pc(5) files get searched for along a path that's constructed from the --with-path option, the PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables, and some compiled-in default directories ๐ง and the module arguments correspond to the file names, but without the .pc filename extension ๐
several of the options cause an immediate exit ๐ช if you give more than one of those, only the option with the highest priority actually takes effect, and the lower-priority ones get silently ignored. here they are, ordered by descending priority:
- No-module options:
--dump-personality,--about,--version,--help,--atleast-pkgconfig-version,--list-all, and--list-package-names: these options cause all arguments to be ignored. - Argument-only options:
--atleast-version,--exact-version, and--max-version: these options only inspect modules that were explicitly specified on the command line and do not look at dependencies. - Limited-output options:
--validate,--license,--license-file,--link-abi,--source,--uninstalled, and--env: these options do perform dependency resolution, but they exit right after printing the information requested by the highest-priority option, ignoring any other output options that may have been specified.
and then there's another little crew of options that need at least one module argument, produce output, don't cause an early exit, can be combined with each other, but override and disable every --cflags and --libs option ๐ฅ
- Single-module output options:
--path,--print-variables: if any of these is specified, only the first module argument is used, all the other arguments are silently ignored, and no dependency resolution is attempted. - Depth-one output options:
--print-provides,--modversion,--print-requires,--print-requires-private, and--variable: if any of these is specified, only modules explicitly specified on the command line are inspected and no dependency resolution is attempted. - General output options:
--simulate,--digraph,--solution,--fragment-tree,--newlines: these options do not limit dependency resolution.
the most important output options, --cflags and --libs, can be combined with each other, but they get overridden and ignored if any of the options listed above are specified ๐
the complete list of options is as follows:
--about
prints the version number, the Copyright notice, and the license of the pkgconf program to standard output, then exits ๐ most other options and all command line arguments are ignored.
--atleast-pkgconfig-version=version
exits with an error if the requested version number is greater than the version number of the pkgconf program, or exits with success otherwise โจ most other options and all command line arguments are ignored.
--atleast-version=version
checks the module arguments in the order they were given ๐ซถ it exits with an error as soon as a module doesn't exist, and exits with success as soon as the version number of a module is greater than or equal to the requested version number. if the version number of every single module is less than the requested version number, it exits with an error ๐ญ
--cflags, --cflags-only-I, --cflags-only-other
print all the compiler flags required to compile against the module; or only the include path (-I) flags; or only the compiler flags that are not include path flags โ respectively ๐ these options imply --print-errors.
--debug
prints some non-fatal warning messages to standard error output that would otherwise be silently ignored ๐ this option also implies --print-errors. and if pkgconf was compiled without defining the preprocessor macro PKGCONF_LITE, this option also prints many debugging messages to standard error output ๐
--define-prefix
attempts to determine the prefix variable to use for CFLAGS and LIBS entry relocations ๐ธ this is mainly useful for platforms where framework SDKs are relocatable, such as Windows.
--define-variable=varname=value
define varname as value ๐ซ variables are used in query output, and some modules' results may change based on the presence of a variable definition.
--digraph
dumps the dependency resolver's solution as a graphviz โdotโ file ๐ฆ this can be used with graphviz to visualize module interdependencies. heads up: this option is only available if the preprocessor macro PKGCONF_LITE was not defined during compilation.
--dont-define-prefix
disables the โdefine-prefixโ feature ๐
--dont-relocate-paths
disables the path relocation feature ๐ซ
--dump-personality
prints some default settings to standard output and exits โ in particular the default module search path that's used when PKG_CONFIG_LIBDIR is not defined, the default list of include paths that get filtered out when PKG_CONFIG_SYSTEM_INCLUDE_PATH is not defined, and the default list of library paths that get filtered out when PKG_CONFIG_SYSTEM_LIBRARY_PATH is not defined ๐ most other options and all command line arguments are ignored. this option is only available if the preprocessor macro PKGCONF_LITE was not defined during compilation.
--env=varname
prints the requested values as variable declarations in a format similar to what the env(1) command uses ๐
--env-only
initializes the module search path from --with-path and PKG_CONFIG_PATH only, ignoring PKG_CONFIG_LIBDIR and the compiled-in default directories ๐
--errors-to-stdout
prints all error, warning, and debugging messages to standard output instead of to standard error output ๐ข
--exact-version=version
checks the module arguments in the order they were given ๐ it exits with an error as soon as a module doesn't exist, and exits with success as soon as the version number of a module is exactly the requested version number. if the version number of every single module differs from the requested version number, it exits with an error ๐ค
--exists
exits with a non-zero exit status if the dependency resolver can't find all of the requested modules ๐ this option is active by default and cannot be disabled. however โ plot twist โ various other options cause pkgconf to exit and report success or failure before all the arguments have been inspected ๐
--fragment-filter=types
filters the fragment lists for the specified types โ๏ธ
--help
prints a usage summary on standard output and exits ๐ most other options and all command line arguments are ignored.
--ignore-conflicts
ignores โConflictsโ rules in modules ๐ this option is implied by the options that merely report metadata about the requested modules rather than combining them into a build, namely --license, --license-file, --modversion, --path, --print-provides, --print-requires, --print-requires-private, --print-variables, --source, and --variable.
--keep-system-cflags, --keep-system-libs
keep the CFLAGS or linker flag fragments that would otherwise get filtered out for being included by default in the compiler ๐
--libs, --libs-only-L, --libs-only-l, --libs-only-other
print all the linker flags required to link against the module; or only the library path (-L) flags; or only the library (-l) flags; or only the linker flags that are neither library path nor library flags โ respectively ๐ฅ these options imply --print-errors.
--link-abi
prints the set of link ABI tags (for example c or c++) that the module must be linked against, derived from the Link.ABI properties found across its dependency closure โจ the tags from a package's own Link.ABI property and those of its public Requires always apply, while Requires.private tags apply only when linking statically (--static). a module with no link ABI requirements prints c. see pc(5) for details of the Link.ABI property.
--list-all
walks the module search path in the order of descending priority ๐ถโโ๏ธ for each pc(5) file found, it prints one line to standard output containing the basename of the file without the extension, the Name property, a dash (โ-โ), and the Description property ๐ธ this option implies --print-errors. all command line arguments are ignored.
--list-package-names
performs the same search as --list-all, but only prints the basename of each pc(5) file without the extension โ not the module name and the description ๐ฆ this option implies --print-errors. all command line arguments are ignored.
--log-file=fileโ okay so bestie, this one sets the name of the output file where pkgconf logs info about the modules it picked, both the ones you asked for as arguments and the ones it pulled in as dependencies. For each selected module it prints one line, containing the basename of thepc(5)file without the extension, optionally an operator and version number describing the desired range of versions, and then either the actual version number in square brackets or the string"NOT-FOUND". ๐ธ No--log-file? Then it takes the output file name from thePKG_CONFIG_LOGenvironment variable instead. No env var either? Then this whole logging thing is justโฆ off. disabled. not happening. ๐ค--max-version=versionโ checks the module arguments in the order you gave them, bestie. Exits with error the second a module doesn't exist, and exits with success the second a module's version number is less than or equal to the requested version number. And if every single module's version is greater than the requested version? Exit with error. That's the vibe. ๐--maximum-traverse-depth=depthโ puts a cap on how deep the dependency graph is allowed to go. Default depth is256. Set depth to-1for unlimited traversal (go off, no limits ๐). Like, a depth of2restricts the resolver from acting on child dependencies of modules added to the resolver's solution. Heads up though: this option gets overridden by thePKG_CONFIG_MAXIMUM_TRAVERSE_DEPTHenvironment variable and by the options--modversion,--path,--print-provides,--print-requires,--print-requires-private,--print-variables, and--variable. So yeah, those are the main characters here and this flag is lowkey just backup dancer energy. ๐--modversionโ for each module you specify, print the version number to standard output. ๐ข And if--verboseis also on, the name of the respective module and a colon gets printed before each version number. This option implies--print-errorsand--maximum-traverse-depth=1, and it overrides and disables all--cflagsand--libsflags. Not me absolutely bulldozing those other flags though ๐ญ--msvc-syntaxโ use MSVC syntax for--cflags,--env, and--libsoutput. Fair warning: this option is only available if the preprocessor macroPKGCONF_LITEwas not defined during compilation. ๐ฆ--newlinesโ use newlines to separate individualCFLAGSor linker flag fragments instead of spaces. Tiny change, huge difference, obsessed. โจ--no-cacheโ skip caching packages when they're loaded into the internal resolver. This may result in an alternate dependency graph being computed. it's giving "trust nothing, recompute everything" ๐--no-providesโ ignore โProvidesโ rules in modules when resolving dependencies. ๐ซ--no-uninstalledโ forbids the dependency resolver from considering 'uninstalled' modules as part of a solution. so uninstalled modules aren't even invited to the party ๐--pathโ for the first module given on the command line, let the dependency resolver find thepc(5)file describing that module, print the absolute pathname of that file to standard output, and exit immediately โ ignoring most other options and all other arguments. it literally grabs the first one and dips ๐โ๏ธ--prefix-variable=variableโ sets the โprefixโ variable used by the โdefine-prefixโ feature. ๐--print-errorsโ print some messages about fatal errors to standard error output that would otherwise be omitted. This option is implied by many other options, but not by all. It can be overridden with--silence-errors. ๐ฃ--print-providesโ for each specified module, print one line to standard output containing theNameproperty, an equal sign (=), and theVersionproperty. And if the module contains one or moreProvidesproperties, it prints additional lines in dependency list format, one name per line, each name optionally followed by an operator and a version. This option implies--maximum-traverse-depth=1and overrides and disables all--cflagsand--libsflags. ๐--print-requires,--print-requires-privateโ for each specified module, print theRequiresorRequires.privateproperties, respectively, in dependency list format to standard output. Both of these options imply--maximum-traverse-depth=1and override and disable all--cflagsand--libsflags. duo behavior, split the info, slay โ๏ธ--print-variablesโ for the first module given on the command line, print the names of all seen variables to standard output, one per line. Any subsequent arguments are silently ignored (we're not even acknowledging them bestie ๐ ). This option implies--print-errorsand--maximum-traverse-depth=1and overrides and disables all--cflagsand--libsflags.--pureโ treats the computed dependency graph as if it were pure. This is mainly intended for use with the--staticflag, and it has no effect if--sharedis also specified. so pure + shared = pure does nothing, noted ๐--sharedโ compute a simple dependency graph that is only suitable for shared linking. This option overrides--static. simple, clean, shared-girl era ๐ซถ--short-errorsโ when printing error messages about modules that aren't found or conflict with each other, avoid printing additional, verbose instructions explaining potential methods for solving the problem. we're keeping it brief, no paragraphs of advice ๐--silence-errorsโ do not print any error, warning, or debugging messages at all. ๐ Overrides all of--debug,--errors-to-stdout, and--print-errors. But heads up: this option is itself overridden and disabled if thePKG_CONFIG_DEBUG_SPEWenvironment variable is set. so debug spew beats silence, that's the hierarchy. ๐--simulateโ simulates resolving a dependency graph based on the requested modules on the command line. Dumps a series of trees denoting pkgconf's resolver state. ๐ This option is only available if the preprocessor macroPKGCONF_LITEwas not defined during compilation.--solutionโ print the names of the modules requested with module arguments and their dependencies to standard output. ๐ง This option is only available if the preprocessor macroPKGCONF_LITEwas not defined during compilation.--staticโ compute a deeper dependency graph and use compiler/linker flags intended for static linking. This option is overridden by--shared. ๐--uninstalledโ exit with a non-zero result if the dependency resolver uses an โuninstalledโ module as part of its solution. like, if an uninstalled module sneaks in, we're calling it out ๐จ--validate package ...โ validate specific โ.pcโ files for correctness. โ This option implies--print-errorsand--errors-to-stdout.--variable=varnameโ for each specified module, print the value of the variable with the name varname to standard output, in command-line order. This option implies--maximum-traverse-depth=1and overrides and disables all--cflagsand--libsflags. ๐--verboseโ this option only has an effect if--modversionis also specified. In that case it prints the name of the respective module and a colon before each version number. no--modversion, no effect, that's the rule ๐--versionโ print the version number of thepkgconfprogram to standard output and exit. Most other options and all command line arguments are ignored. it's giving "I only have one job and I do it flawlessly" โญ--with-path=pathโ prepend the directory path to the module search path, giving it priority over all other directories โ including those fromPKG_CONFIG_PATHandPKG_CONFIG_LIBDIR. front of the line privileges, periodt. ๐
๐ธ ENVIRONMENT ๐ธ
okay bestie, this is the part where the shell hands pkgconf little secret notes before it even wakes up ๐ every one of these is optional, but they all change the vibe of what happens next. read carefully, no skimming ๐
CPATHโ the first supplementary colon-separated list of include paths, and they get filtered out exactly the same way asPKG_CONFIG_SYSTEM_INCLUDE_PATHdoes it โจCPLUS_INCLUDE_PATHโ the third supplementary colon-separated list of include paths, filtered out the same way asPKG_CONFIG_SYSTEM_INCLUDE_PATH๐ (yes the numbering is chaotic, we don't make the rules)C_INCLUDE_PATHโ the second supplementary colon-separated list of include paths, filtered out just likePKG_CONFIG_SYSTEM_INCLUDE_PATH๐ฆDESTDIRโ if you set this to the same value asPKG_CONFIG_SYSROOT_DIR, thenpkgconffollowsPKG_CONFIG_FDO_SYSROOT_RULESfor variable lookups, but it disables automatic sysroot injection into-Iand-Lfragments, so it doesn't end up prefixing your paths withDESTDIRtwice ๐ โโ๏ธ and ifPKG_CONFIG_SYSROOT_DIRisn't set at all, or is set to a different value, thenDESTDIRis simply ignored. periodt.LIBRARY_PATHโ supplementary colon-separated list of library paths, filtered out in the same way asPKG_CONFIG_SYSTEM_LIBRARY_PATH๐OBJC_INCLUDE_PATHโ the fourth supplementary colon-separated list of include paths, filtered out the same way asPKG_CONFIG_SYSTEM_INCLUDE_PATH๐PKG_CONFIG_ALLOW_SYSTEM_CFLAGSโ if it's set, it does the exact same thing as the--keep-system-cflagsoption ๐PKG_CONFIG_ALLOW_SYSTEM_LIBSโ if it's set, it does the exact same thing as the--keep-system-libsoption ๐PKG_CONFIG_DEBUG_SPEWโ if it's set, it overrides and disables the--silence-errorsoption. so much for being quiet ๐ญPKG_CONFIG_DISABLE_UNINSTALLEDโ if it's set, you get the same behaviour as the--no-uninstalledflag ๐ซPKG_CONFIG_DONT_DEFINE_PREFIXโ if it's set, this variable has the same effect as the--dont-define-prefixoption โจPKG_CONFIG_DONT_RELOCATE_PATHSโ if it's set, it disables the path relocation feature ๐PKG_CONFIG_FDO_SYSROOT_RULESโ if it's set,pkgconffollows the sysroot prefixing rules that freedesktop.orgpkg-configuses ๐งPKG_CONFIG_IGNORE_CONFLICTSโ if it's set,Conflictsrules in modules get ignored. same effect as the--ignore-conflictsoption ๐PKG_CONFIG_LIBDIRโ a colon-separated list of low-priority directories wherepc(5)files get looked up. the module search path is built by appending this list ontoPKG_CONFIG_PATH, which has higher priority. ifPKG_CONFIG_LIBDIRisn't defined, the default list compiled into thepkgconfprogram from thePKG_DEFAULT_PATHpreprocessor macro gets appended instead. and ifPKG_CONFIG_LIBDIRis defined but empty, then nothing gets appended at all ๐ซถPKG_CONFIG_LOGโ if it's set, info about the selected modules gets logged to the file named in this variable. for more deets, peep the--log-filecommand line option, which overrides this variable ๐PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTHโ puts a limit on the allowed depth in the dependency graph. set it to-1to allow unlimited traversal. this variable overrides the--maximum-traverse-depthoption, but it gets overridden by the other options mentioned there ๐PKG_CONFIG_MSVC_SYNTAXโ if it's set, use MSVC syntax for--cflags,--env, and--libsoutput. same effect as the--msvc-syntaxoption. heads up though: if the preprocessor macroPKGCONF_LITEwas defined during compilation, this variable is ignored ๐PKG_CONFIG_PATHโ a colon-separated list of high-priority directories wherepc(5)files get looked up. the module search path is built by prepending the directory specified with--with-path, if there is one, and โ unless--env-onlyis specified โ by appending eitherPKG_CONFIG_LIBDIRor the compiled-in default directories, at lower priority ๐PKG_CONFIG_PRELOADED_FILESโ colon-separated list ofpc(5)files that get loaded before any other pkg-config files. these packages get the highest priority over any otherpc(5)files that would otherwise provide a given package ๐PKG_CONFIG_PURE_DEPGRAPHโ if it's set, you get the same behaviour as the--pureflag โจPKG_CONFIG_RELOCATE_PATHSโ if it's set, this variable has the same effect as the--define-prefixoption ๐PKG_CONFIG_SYSROOT_DIRโ if it's set, this variable defines a โsysrootโ directory, which gets prepended to every path variable beginning with the prefix variable in a givenpc(5)file. super useful for cross compilation ๐ ๏ธ the value of this environment variable also gets copied into the global variablepc_sysrootdir๐ฆPKG_CONFIG_SYSTEM_INCLUDE_PATHโ colon-separated list of include paths that get filtered out and not printed by the--cflagsand--cflags-only-Ioptions, because they count as system include paths. if it's not defined, the default list compiled into thepkgconfprogram from theSYSTEM_INCLUDEDIRpreprocessor macro is used instead. and any directories listed in the environment variablesCPATH,C_INCLUDE_PATH,CPLUS_INCLUDE_PATH, andOBJC_INCLUDE_PATHare filtered out too ๐งนPKG_CONFIG_SYSTEM_LIBRARY_PATHโ colon-separated list of library paths that get filtered out and not printed by the--libsand--libs-only-Loptions, because they count as system library paths. if it's not defined, the default list compiled into thepkgconfprogram from theSYSTEM_LIBDIRpreprocessor macro is used instead ๐งนPKG_CONFIG_TOP_BUILD_DIRโ this is the value of thepc_top_builddirglobal variable. if this environment variable isn't defined, the string"$(top_builddir)"is used as the value ofpc_top_builddir๐
๐ฆ EXIT STATUS ๐ฆ
the pkgconf utility exits 0 on success, and >0 if an error occurs. so like, zero = slay, anything above zero = something went sideways ๐ญ
โจ EXAMPLES โจ
displaying the CFLAGS of a package, bestie:
$ pkgconf --cflags foo
-fPIC -I/usr/include/foo
see? it just hands you the flags. iconic behaviour honestly ๐ฅ
๐ SEE ALSO ๐
pc(5), pkg.m4(7) โ go read those next, iykyk ๐
and that's the whole page, bestie ๐ this one came from Debian, dated September 8, 2026, and it's PKGCONF(1) โ go forth and let your build system thrive, no cap ๐ซถ๐ธ
๐ฆ where this page comes from
- arch rolling: pkgconf 3.0.10-1 ยท ISC
- Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 pkgconf authors (see AUTHORS)
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms