CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

pkgconf

$ pkgconf 社区开源 低风险
pkgconf · 代码托管与研发协同 · ISC · macos / linux / windows

pkgconf 解析 .pc 元数据文件,为 C/C++ 工具链输出编译器包含路径(--cflags)、链接库参数(--libs)及依赖图模拟(--simulate)。它是一个高速、纯只读的 C 二进制工具,替代了传统的 pkg-config,退出码清晰且输出纯文本。

FCRS-1.0 综合评分
77 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install pkgconf
CLI vs MCP 选型建议 仅 CLI 可用

pkgconf 直接读取本地系统 .pc 元数据文件并为本地编译器返回精确参数,不适用 MCP。

Agent 友好度体检单

本地探针实测证据
— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
✓ 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md
实测版本
3.0.7
冷启动耗时
8 ms
退出码 (help / 非法参数)
0 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
usage: pkgconf [OPTIONS] [LIBRARIES]

basic options:

  --help                            this message
  --about                           print pkgconf version and license to stdout
  --version                         print supported pkg-config version to stdout
  --verbose                         print additional information
  --atleast-pkgconfig-version       check whether or not pkgconf is compatible
                                    with a specified pkg-config version
  --errors-to-stdout                print all errors on stdout instead of stderr
  --print-errors                    ensure all errors are printed
  --short-errors                    be less verbose about some errors
  --silence-errors                  explicitly be silent about errors
  --list-all                        list all known packages
  --list-package-names              list all known package names
  --simulate                        simulate walking the calculated dependency graph
  --no-cache                        do not cache already seen packages when
                                    walking the dependency graph
  --log-file=filename               write an audit log to a specified file
  --with-path=path                  adds a directory to the search path
  --define-prefix                   override the prefix variable with one that is guessed based on
                                    the location of the .pc file
  --dont-define-prefix              do not override the prefix variable under any circumstances
  --prefix-variable=varname         sets the name of the variable that pkgconf considers
                                    to be the package prefix
  --dont-relocate-paths             disables path relocation support

cross-compilation personality support:

  --personality=triplet|filename    sets the personality to 'triplet' or a file named 'filename'
  --dump-personality                dumps details concerning selected personality

checking specific pkg-config database entries:

  --atleast-version                 require a specific version of a module
  --exact-version                   require an exact version of a module
  --max-version                     require a maximum version of a module
  --exists                          check whether or not a module exists
  --uninstalled                     check whether or not an uninstalled module will be used
  --no-uninstalled                  never use uninstalled modules when satisfying dependencies
  --n

FCRS-1.0 六维评分拆解

Agent 友好度 16 / 25

高速、确定且无交互的只读查询(--cflags、--libs、--modversion、--exists),但输出为编译器参数文本且无 --json。

  • --exists --print-errors gives unambiguous exit codes and diagnostics
  • No --json output mode
安全与权限边界 23 / 25

严格只读的元数据查询工具,无任何文件修改、网络请求或凭据处理。

  • Pure read-only .pc file evaluator
安装与运行摩擦 13 / 15

轻量级原生 C 二进制,可通过 Homebrew、Linux 各发行版及 MSYS2/Windows 安装。

  • Zero-dependency native C binary across macOS, Linux, and Windows
能力覆盖与边际价值 11 / 15

在亚毫秒级内完成原生库发现与版本校验(--atleast-version)。

  • Replaces slower GLib-based pkg-config with a fast C library/CLI
维护与来源背书 7 / 10

社区积极维护的 pkgconf/pkgconf 项目(ISC 协议),已是 Homebrew、Alpine、Fedora 等系统的默认实现。

  • Default pkg-config implementation on major distros and Homebrew
文档与可验证性 7 / 10

--help 与 pkgconf(1) 手册页清晰完整,但独立网页文档较少。

  • Comprehensive --help and man page flags

安全边界、鉴权与放权指南

鉴权方式
无需鉴权
凭证存储位置

无需身份认证或用户状态存储;仅从 PKG_CONFIG_PATH 与系统目录读取 .pc 元数据。

潜在副作用
只读查询
费用与配额提示

ISC 开源 CLI,免费使用。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# pkgconf Agent Rules
- Use `pkgconf --exists --print-errors <pkg>` before guessing header or library paths.
- Pass `PKG_CONFIG_PATH` explicitly when querying keg-only Homebrew or custom prefix `.pc` files.

Agent 高频安全命令配方

只读查询(安全推荐)

列出所有可发现的系统库包
pkgconf --list-all

枚举 PKG_CONFIG_PATH 上可见的全部 .pc 包及其简短说明。

查询指定库的编译与链接参数
pkgconf --cflags --libs openssl

输出编译和链接 openssl 所需的精确 -I、-L 与 -l 参数。

核心优势

  • + 完全只读、亚毫秒级 .pc 元数据解析,且退出码含义明确。
  • + --simulate、--print-errors 与 --errors-to-stdout 便于快速排查缺失的原生依赖。
  • + 无缝兼容 pkg-config 且无需沉重的 GLib 运行时。

注意事项与踩坑点

  • ! 输出为原始编译器/链接器参数字符串,而非 --json。
  • ! 查询 Homebrew keg-only 或非标准前缀的库时需显式设置 PKG_CONFIG_PATH。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI