概述
compat.openssl@3.5.1 在安装了 perl 二进制、但缺少核心模块 FindBin.pm 的机器上无法安装(复现于 Fedora 44 /
WSL,/usr/sbin/perl v5.42.2)。描述符的预检只检查 PATH 上有没有 perl(command -v perl),没有验证 perl
能不能真正跑起来,导致失败发生在 OpenSSL ./Configure 内部,完全看不出真实原因。
环境
- 操作系统:Fedora Linux 44 (WSL2), x86_64
- perl:/usr/sbin/perl v5.42.2 —— find / -name FindBin.pm 无任何结果(核心模块缺失)
- mcpp 2026.8.1.1,包 compat.openssl@3.5.1(来自本索引)
复现步骤
- 在某个 workspace 里声明 [dependencies.compat] 下的 openssl = "3.5.1"。
- 在 compat-x-openssl 包目录为干净状态时执行 mcpp build。
期望行为
要么正常安装,要么 install() 用一个能看懂的错误信息指明真实问题(perl 存在但不可用)。
实际行为
mcpp build 中止,报:
error: xlings install_packages failed (exit 1) for 'compat.openssl@3.5.1' ...
唯一线索是 data/xpkgs/compat-x-openssl/3.5.1/mcpp_openssl_build.log:
Can't locate FindBin.pm in @inc (you may need to install the FindBin module)
(@inc entries checked: /usr/local/lib64/perl5/5.42 ... /usr/share/perl5)
at .../openssl-3.5.1/Configure line 15.
BEGIN failed--compilation aborted at .../openssl-3.5.1/Configure line 15.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install_sw'. Stop.
没有产出 libcrypto.a / libssl.a → install() 返回 false → 安装失败。
根因
tarball 下载和 sha256 校验都正常,问题出在源码构建这一步:./config 是 Perl 脚本,Configure 第 15 行 use FindBin;
直接编译失败,因为这台机器的 perl 缺 FindBin.pm。而描述符的探测(have("perl") → command -v perl >/dev/null
2>&1)只检查 PATH 上有没有 perl 二进制,没有验证 perl 能否实际运行。描述符注释里其实已经提到了这类风险("a stripped
container may not ..."),但探测逻辑没兜住。
建议修复
在 install() 里、开始构建之前验证 perl 可用,例如:
if not have("perl") then
-- 保留现有的 "perl not found" 分支
end
-- 验证 perl 真的能跑,而不只是存在于 PATH
if not pcall(function()
os.exec("bash -c 'perl -MFindBin -MConfig -MFile::Path -e exit 2>/dev/null'")
end) then
log.error("compat.openssl: PATH 上的 perl 不可用——OpenSSL 的 ./config "
.. "需要带核心模块(FindBin、Config、File::Path)的完整 perl。"
.. "请安装完整的 perl 后重试。")
return false
end
相关现象(同一条安装链路,会放大排查难度)
- 安装失败后会残留 .xpkg.lua,下一次执行同样的 xlings interface install_packages 会返回 {"exitCode":0} 且不再重跑
install() —— 在包目录被清理之前,真实失败被掩盖。(mcpp 的 integrity: cleaning incomplete install
恰好是能稳定复现的原因。)
- mcpp 报 "xlings emitted no structured error",但 xlings 其实在结果前输出了
{"dataKind":"install_summary","payload":{"failed":1,...}},只是没有被透传出来。
概述
compat.openssl@3.5.1 在安装了 perl 二进制、但缺少核心模块 FindBin.pm 的机器上无法安装(复现于 Fedora 44 /
WSL,/usr/sbin/perl v5.42.2)。描述符的预检只检查 PATH 上有没有 perl(command -v perl),没有验证 perl
能不能真正跑起来,导致失败发生在 OpenSSL ./Configure 内部,完全看不出真实原因。
环境
复现步骤
期望行为
要么正常安装,要么 install() 用一个能看懂的错误信息指明真实问题(perl 存在但不可用)。
实际行为
mcpp build 中止,报:
error: xlings install_packages failed (exit 1) for 'compat.openssl@3.5.1' ...
唯一线索是 data/xpkgs/compat-x-openssl/3.5.1/mcpp_openssl_build.log:
Can't locate FindBin.pm in @inc (you may need to install the FindBin module)
(@inc entries checked: /usr/local/lib64/perl5/5.42 ... /usr/share/perl5)
at .../openssl-3.5.1/Configure line 15.
BEGIN failed--compilation aborted at .../openssl-3.5.1/Configure line 15.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target 'install_sw'. Stop.
没有产出 libcrypto.a / libssl.a → install() 返回 false → 安装失败。
根因
tarball 下载和 sha256 校验都正常,问题出在源码构建这一步:./config 是 Perl 脚本,Configure 第 15 行 use FindBin;
直接编译失败,因为这台机器的 perl 缺 FindBin.pm。而描述符的探测(have("perl") → command -v perl >/dev/null
2>&1)只检查 PATH 上有没有 perl 二进制,没有验证 perl 能否实际运行。描述符注释里其实已经提到了这类风险("a stripped
container may not ..."),但探测逻辑没兜住。
建议修复
在 install() 里、开始构建之前验证 perl 可用,例如:
if not have("perl") then
-- 保留现有的 "perl not found" 分支
end
-- 验证 perl 真的能跑,而不只是存在于 PATH
if not pcall(function()
os.exec("bash -c 'perl -MFindBin -MConfig -MFile::Path -e exit 2>/dev/null'")
end) then
log.error("compat.openssl: PATH 上的 perl 不可用——OpenSSL 的 ./config "
.. "需要带核心模块(FindBin、Config、File::Path)的完整 perl。"
.. "请安装完整的 perl 后重试。")
return false
end
相关现象(同一条安装链路,会放大排查难度)
install() —— 在包目录被清理之前,真实失败被掩盖。(mcpp 的 integrity: cleaning incomplete install
恰好是能稳定复现的原因。)
{"dataKind":"install_summary","payload":{"failed":1,...}},只是没有被透传出来。