Perl日記

日々の知ったことのメモなどです。Perlは最近やってないです。

Perl5.10.1入れてみた

どうもMacBookの方の中身がごちゃごちゃになってきてたので、一度OSを再インストールした。
OSはSnow Leopard
メインで使ってるiMacの方もどうせだからLeopardからアップデートさせようと思っていたし、その予行みたいな感じにした。
で、Snow LeopardデフォルトのPerlのバージョンは5.10.0なわけだけれど、これはこれで置いておいて、別のところに5.10.1を入れたかったので入れてみた。
JPerl Advent Calendor 2009でそういうのを見たからでもあるのだけれど。
Have Your Own Perl! - JPerl Advent Calendar 2009
思いっきり上記を参考に /usr/local/ にインストールするまで。

$ mkdir perl5.10.1
$ cd perl5.10.1/
$ curl -O http://www.cpan.org/src/perl-5.10.1.tar.bz2
$ tar jxf perl-5.10.1.tar.bz2
$ sh Configure -DDEBUGGING -Doptimize='-g -pipe -Os' -Dusethreads -Dusemultiplicity -Dprefix=/usr/local -des

ちょっとだけ古いMacBookだったので64bitに対応しているか分からなかった。
ので、"-Duse64bitall" は外しておいた。

$ make
$ make test
.........
Failed 1 test out of 1666, 99.94% okay.
	../lib/locale.t
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You have a good chance to get more information by running
###   ./perl harness
### in the 't' directory since most (>=80%) of the tests succeeded.
### You may have to set your dynamic library search path,
### DYLD_LIBRARY_PATH, to point to the build directory:
###   setenv DYLD_LIBRARY_PATH `pwd`; cd t; ./perl harness
###   DYLD_LIBRARY_PATH=`pwd`; export DYLD_LIBRARY_PATH; cd t; ./perl harness
###   export DYLD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
u=4.51  s=2.64  cu=468.98  cs=62.39  scripts=1666  tests=234769
make[2]: *** [_test_tty] Error 1
make[1]: *** [_test] Error 2
make: *** [test] Error 2

"dynamic library search path"なるものがないと怒られる。
注意されてるようにセットする。bashなのでexportで。

$ export DYLD_LIBRARY_PATH=`pwd`

気をとりなおしてもう一度make test。

$ make test
.........
Failed 1 test out of 1666, 99.94% okay.
	../lib/locale.t

うーん。
解決策を探してたら、以下の方も同じエラーが出ていた。
Perl 5.11.0 がでてたのでコンパイルしてみた - クラなんとか or くらなんとか or cla なんとかの日記
2009-10-11 - なんとな〜く日記
が、やはりよく分からない。
実際にエラー出してるlib/locale.tだけ実行してみる。

$ ./lib/locale.t
…
#
# The locale definition
#
#	be_BY.CP1131
#
# on your system may have errors because the locale test 99
# failed in that locale.
#
# If your users are not using these locales you are safe for the moment,
# but please report this failure first to perlbug@perl.com using the
# perlbug script (as described in the INSTALL file) so that the exact
# details of the failures can be sorted out first and then your operating
# system supplier can be alerted about these anomalies.
#
# The following locales
#
#	C C POSIX POSIX af_ZA af_ZA.ISO8859-1 af_ZA.ISO8859-15
#	...

「be_BY.CP1131」がないってことなのか?
このロケール使わないんなら問題ないのかなー。
もしダメだったらもう一回すればいいだけだし、じゃあinstall。

$ sudo make install
...
$ /usr/local/bin/perl -v

This is perl, v5.10.1 (*) built for darwin-thread-multi-2level
...

できた。
あとは5.10.0でできなくて、5.10.1でできることを試してみて確認したかったけど、変更点見てすぐに(自分が)分かりそうなのがなかったのでCGI.pmのバージョン確認をしてみる。

$ /usr/local/bin/perl -MCGI -le 'print $CGI::VERSION'
3.43

よし、(多分)大丈夫。
明日はCPANの設定とPATHの設定をしよーっと。