CPANのSegmentation fault 問題解決編


「PerlのCPANが使えくなって困った話」でいったん手動インストールで終わった(逃げきった)かに見えたCPAN問題ですが、手動インストールでも問題発生し、いよいよ腰を据えて対処せざるをえなくなってきました。そう、あいつが手動インストールの画面にも出てきたのです。

at /usr/lib/perl5/5.8.8/ExtUtils/Liblist.pm line 6.
Segmentation fault

ちょっとちょっと・・・・ということで、再びGoogle検索です。今回はツキがあったのか早々に有用と思われるページにあたりました。

やはりみなさん苦労されている

http://www.perlmonks.org/?node_id=1089524

つらつらと読んでいきます。あ、先に別サイトで読んだPerl再インストール&特定ディレクトリ下すべての消去というのも出てきました。その下。

Segmentation fault
Other scritps produced this error:
Attempt to free unreferenced scalar: SV 0xe07c990, Perl interpreter: 0
+xe055010 at /usr/lib/perl5/5.8.8/FindBin.pm line 101.
Segmentation fault
Downgraded perl to perl-5.8.8-42.el5 and still got the same problem

The problem is that we installed something via CPAN that is a differen
+t version then what redhat perl uses.
I duplicated this problem by creating a CentOS image ( CentOS release
+5.11 (Final) )
This installed perl-5.8.8-42.el5. I updated everything except perl.
I then installed cpan bundle ( cpan> install Bundle::CPAN )
At this point everything still works.
yum update -> installed the perl-5.8.8-43.el5
This broke cpan and other modules.

It looks like this is the main culprit:
Cwd was downgraded when perl was upgraded.
Module id = Cwd
CPAN_USERID SMUELLER (Steffen Mueller smueller@cpan.org)
CPAN_VERSION 3.47
CPAN_FILE S/SM/SMUELLER/PathTools-3.47.tar.gz
MANPAGE Cwd – get pathname of current working directory
INST_FILE /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Cwd.pm
INST_VERSION 3.12

で直し方!これで治りました。

The fix:
Download PathTools-3.47 from CPAN
http://search.cpan.org/~smueller/PathTools-3.47/

edit MakeFile.PL
In Makefile.PL in PathTools-3.47
Before the following line add “use File::Spec” (It must be before the
+line “use ExtUtils::MakeMaker;” )
Like so:
use File::Spec;
use ExtUtils::MakeMaker;

# make
# make test
PERL_DL_NONLAZY=1 /usr/bin/perl “-MExtUtils::Command::MM” “-e” “test_h
+arness(0, ‘blib/lib’, ‘blib/arch’)” t/*.t
t/crossplatform………ok 1/71Can’t use an undefined value as an ARRA
+Y reference at /usr/lib/perl5/5.8.8/Test/Harness.pm line 373.
make: *** [test_dynamic] Error 255

I went ahead and ran make install anyways.
# make install

ちなみにPathTools-3.47はCPANサイトからWGETでダウンロードしました。MakeFile.PLは上記手順にあわせて修正します。。

http://search.cpan.org/~smueller/PathTools-3.47/

上記サイトではさらにCPANコマンドラインで「install Test::Harness」を実行したらエラーは出たとのことでエラー修復手順が載っていましたが、私のケースでは、すんなりモジュールインストール出来ましたのでこれで対応完了です。

英語サイトのドキュメントの豊富さにはいつも助けられます

自分の場合は意味不明な対処しきれないエラーが出た場合は、まず日本語で誰か解説してくれていないかな・・と調べて、無い場合に初めて英語サイトの検索を始めます。やはり英語で読むよりも日本語の方が楽ですもんね。

ということでこの記事ももしかしたら誰かの役に立てるかもしれないので、ほぼ自己満足ながらアップしておきます。