【问题标题】:How to specify external library file locations when installing CPAN modules安装 CPAN 模块时如何指定外部库文件位置
【发布时间】:2021-09-13 14:51:35
【问题描述】:

我正在尝试让 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

四处挖掘,我发现我的系统上的关键字.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,或其他一些安装工具)在哪里寻找这些头文件?或者,欢迎使用任何其他方法来实现此功能。

【问题讨论】:

    标签: macos perl cpan


    【解决方案1】:

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

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

    • 在不运行测试的情况下安装模块 (sudo cpan -T B::Keywords)
    • Submit an issue 在 GitHub 问题跟踪器上,以便模块的作者可以解决问题。
    • 使用perlbrew 安装模块,而不是使用系统 perl(我对此进行了测试,它在这里运行良好)。

    【讨论】:

    • 请注意,Apple 建议您不要使用它分发的系统 perl:developer.apple.com/library/archive/documentation/Security/…
    • 感谢 Håkon 和 Brian --- 我不愿意走 perlbrew 路线,但如果 Apple 建议不要使用 System perl,那可能是最好的方法。
    • 您已经离开了生态系统,因为您没有使用用于安装perl 的包管理器。到那时,您不妨安装自己的。
    猜你喜欢
    • 2013-09-24
    • 2016-02-11
    • 2016-07-08
    • 1970-01-01
    • 2011-04-13
    • 2018-06-19
    • 2014-12-06
    • 2013-11-04
    • 1970-01-01
    相关资源
    最近更新 更多