安装 CPAN 模块时如何指定外部库文件位置

psi*_*siz 5 macos perl cpan

我正在尝试让 Perl 的 Finance::Quote 模块在 MacOS 升级到 11.4 后正常工作。依赖项之一是 B::Keywords。B::Keywords 安装测试失败并出现以下错误:

> sudo cpan B::Keywords
[...]
Can't open /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h: No such file or directory at t/11keywords.t line 25
Run Code Online (Sandbox Code Playgroud)

仔细研究后,我发现 keywords.h 存在于我的系统中的以下位置:

/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h

有没有办法告诉 cpan(或 cpanm,或其他一些安装工具)在哪里查找这些标头?或者,任何其他方法来使其发挥作用将受到欢迎。

Håk*_*and 5

似乎他们从macOS 10.14 上的系统 perl 的目录(相对于 给出的路径)keywords.h中删除了 ,请参阅错误报告。CORE$Config{archlibexp}

您无法安装的原因B::Keywords是测试11keywords.t失败,请参阅第 24 行。一些可能的解决方案:

  • 请注意,Apple 建议您不要使用它分发的系统 perl:https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/FileSystemProtections/FileSystemProtections.html#//apple_ref/doc/uid/ TP40016462-CH2-SW1 (3认同)