我新的基于 M1 的 Mac 具有 Apple 的内置 Perl 版本 v5.28.2。我使用自制软件安装了最新的 perl 5.32.0,并配置了 local::lib 选项,以便将 cpan 模块安装在 ~/perl5 中。所有这些在大多数情况下都有效。
但是...我无法在这个 homebrew/local-lib 配置中安装 XML:Parser。我认为 XML::Parser 安装在 Apple 的基本配置中,但我真的希望能够更新 Perl 并安装模块,所以我认为这个配置是正确的方法。但是很多东西需要 XML::Parser。
这是我的环境变量、PATH 等:
PERL5LIB=/Users/jim/perl5/lib/perl5
PERL_LOCAL_LIB_ROOT=/Users/jim/perl5
PERL_MB_OPT=--install_base "/Users/jim/perl5"
PERL_MM_OPT=INSTALL_BASE=/Users/jim/perl5
PATH=/Users/jim/perl5/bin:.:/Users/jim/Documents/scripts:/opt/homebrew/bin:/Developer/usr/bin:/System/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/jim/Library/Python/2.7/bin:/Users/jim/perl5/bin:/Users/jim/go/bin:/Users/jim/.cargo/bin:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11/bin
% /usr/bin/which -a perl
/opt/homebrew/bin/perl
/usr/bin/perl
% /usr/bin/which -a cpan
/Users/jim/perl5/bin/cpan
/opt/homebrew/bin/cpan
/Users/jim/perl5/bin/cpan
/usr/bin/cpan
运行cpan install XML::Parser
给出:
Running make test for TODDR/XML-Parser-2.46.tar.gz
"/opt/homebrew/Cellar/perl/5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs 644
Manifying 1 pod document
PERL_DL_NONLAZY=1 "/opt/homebrew/Cellar/perl/5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/astress.t ........... 1/27
Can't load '/Users/jim/.cpan/build/XML-Parser-2.46-0/blib/arch/auto
/XML/Parser/Expat/Expat.bundle' for module XML::Parser::Expat:
dlopen(/Users/jim/.cpan/build/XML-Parser-2.46-0/blib/arch/auto
/XML/Parser/Expat/Expat.bundle, 2): Symbol not found: _XML_DefaultCurrent
Referenced from: /Users/jim/.cpan/build/XML-Parser-2.46-0/blib/arch/auto/XML/Parser/Expat/Expat.bundle
Expected in: flat namespace
in /Users/jim/.cpan/build/XML-Parser-2.46-0/blib/arch/auto/XML/Parser/Expat/Expat.bundle at /opt/homebrew/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/DynaLoader.pm line 197.
at /Users/jim/.cpan/build/XML-Parser-2.46-0/blib/lib/XML/Parser.pm line 18.
Compilation failed in require at /Users/jim/.cpan/build/XML-Parser-2.46-0/blib/lib/XML/Parser.pm line 18.
BEGIN failed--compilation aborted at /Users/jim/.cpan/build/XML-Parser-2.46-0/blib/lib/XML/Parser.pm line 22.
Compilation failed in require at t/astress.t line 11.
BEGIN failed--compilation aborted at t/astress.t line 11.
t/astress.t ........... Dubious, test returned 2 (wstat 512, 0x200)
Failed 27/27 subtests
(错误消息中添加了换行符以使其可读。)
在那之后还有更多的测试失败,但我认为这就是问题的根源。
有什么建议么?