Masteries

技術的なことや仕事に関することを書いていきます.

小ネタ: Big SurでXML::Parserのインストールに失敗する件

MacのBig SurかつPerl 5.32.0の環境でXML::Parserをインストールしようとしたところ, 次のように失敗しました:

--> Working on XML::Parser
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/XML-Parser-2.46.tar.gz ... OK
Configuring XML-Parser-2.46 ... OK
Building and testing XML-Parser-2.46 ... FAIL
! Installing XML::Parser failed. See /path/to/.cpanm/work/1612254113.90705/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'XML::Parser' is not installed

~/.cpanm/build.log にログがあるので読んでみると, 次のようなメッセージがありました.

Can't load '/path/to/.cpanm/work/1612254113.90705/XML-Parser-2.46/blib/arch/auto/XML/Parser/Expat/Expat.bundle' for module XML::Parser::Expat: dlopen(/Users/papix/.cpanm/work/1612254113.90705/XML-Parser-2.46/blib/arch/auto/XML/Parser/Expat/Expat.bundle, 2): Symbol not found: _XML_DefaultCurrent

「perl Symbol not found: _XML_DefaultCurrent」でググってみると, 次のStack Overflowがヒット.

stackoverflow.com

これはM1 Macでの話ですが, コメントを見ると,

Installing the latest beta release of ExtUtils::MakeMaker (7.57_02) should solve your problem. It will probably be released as a stable release soon.

とありました. 調べてみると, 2021年2月2日現在のExtUtils::MakeMakerの最新版は7.58だったので, 先に cpanm ExtUtils::MakeMake してから改めて cpanm XML::Parser すると, うまくインストールできました.