Perlインストール記録

なんだかんだでPerlを5.8.7から5.10.0にバージョンアップ。

CPANよりコードを落としてくる:http://www.cpan.org/

 $ tar xvfz perl-5.10.0.tar.gz
 $ ./Configure -de -Duseshrplib
 $ make
 $ make test

「./Configure」のオプションに「-Dusershrplib」を付けると「libperl.a」及び「libperl.so」ができる。なんだけど〜「make test」でこけた。

エラーが発生している。

Failed 1 test out of 1382, 99.93% okay.
        ../ext/Sys/Syslog/t/syslog.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,
### LD_LIBRARY_PATH, to point to the build directory:
###   setenv LD_LIBRARY_PATH `pwd`:$LD_LIBRARY_PATH; cd t; ./perl harness
###   LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd t; ./perl harness
###   export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
u=0.35  s=21.50  cu=183.54  cs=209.58  scripts=1382  tests=187599
make[2]: *** [_test_tty] エラー 1
make[2]: Leaving directory `/home/knoppix/perl-5.10.0'
make[1]: *** [_test] エラー 2
make[1]: Leaving directory `/home/knoppix/perl-5.10.0'
make: *** [test] エラー 2

いやいやながら英語のエラーを読むと、「LD_LIBRARY_PATH」が設定していないらしい。実際に設定してなかったの設定する。設定と言うか上記に書いてあるようにやる。

 $ export LD_LIBRARY_PATH=`pwd`
 $ echo $LD_LIBRARY_PATH

これで、再度「make test」を実行しテストが通れば「make install」を実行。

エラー等沢山出たが最終的に実行したコマンドをまとめる。

 $ tar xvfz perl-5.10.0.tar.gz
 $ ./Configure -de -Duseshrplib
 $ make
 $ make test
 # make install

今回インストールしたPerlの処理系は「/usr/local/bin/perl」となり、今まで利用していたPerlの処理系は「/usr/bin/perl」なのよん。当然、現時点で、「$ perl -v」とやったら「/usr/bin/perl」の旧版が動くんだわ〜これはどうするべき。私は念のため「/usr/bin/perl」をバックアップして、「/usr/local/bin/perl」にソフトリンクをはった。

 # mv /usr/bin/perl /usr/bin/perl_back
 # ls -s /usr/bin/perl perl

その後、ある程度動かして新しくインストールしたPerlが問題なさそうであれば旧perl版は削除したけどね。そんな感じでいいよね。

それで重要なのは、「libperl.a」や「libperl.so」が作成されているかどうかなんだ。見たところ「libperl.so」はあったけど「libperl.a」は無かったね。まあ、問題ないだろ。その後、mod_perlのインストール。

$ perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
$ make
# make install

+--------------------------------------------------------------+
|                                                              |
| For details on getting started with mod_perl 2, see:         |
|                                                              |
|   http://perl.apache.org/docs/2.0/user/intro/start_fast.html |
|                                                              |
|                                                              |
| Found a bug?  File a bug report:                             |
|                                                              |
|   http://perl.apache.org/bugs/                               |
|                                                              |
+--------------------------------------------------------------+

成功した!うし!

knoppix@0[perl-5.10.0]$ cd /usr/local/apache2/modules/
knoppix@0[modules]$ ls -la
合計 212
drwxr-sr-x   2 root    staff      112 2009-07-07 23:03 .
drwxr-sr-x  15 root    staff      360 2009-07-05 00:07 ..
-rw-r--r--   1 knoppix knoppix   9046 2009-07-05 00:05 httpd.exp
-rwxr-xr-x   1 root    staff   203415 2009-07-07 23:03 mod_perl.so

おお〜Apacheのモジュール格納場所にmod_perl.soができているよ。成功だね。次はmod_perlの勉強を行っていこうかな。では

mod_perlインストール記録

以前、mod_perlの環境を構築したので、その思い出を忘れないために記す。

ちなみにインストールしたVERSION情報。

app version
apache httpd-2.2.11.tar.gz
mod_perl mod_perl-2.0-current.tar.gz
perl perl-5.10.0.tar.gz
mod_perl install
 $ tar xvfz ./mod_perl-2.0-current.tar.gz
 $ cd mod_perl-2.0-current
 $ perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
 $ make
 # make install
「apxs」とは何ぞや!

Apacheに標準でインストールされていないモジュールを組み込む際に利用するツールと理解している。今回、mod_perlをインストールするに当たって、そのアプリの場所をMP_APXSに覚えさせているわけだ。

apxs ・・・ APache eXtenSion

でだ、上記一連の流れを行えば簡単にインストールできるはずなんだができなんだ。なんでだ、Makefile.PLだんかいでWARNINGが発生している。それがこれ、

 ************* WARNING *************

  Your Perl is configured to link against libgdbm,
  but libgdbm.so was not found.
  You could just symlink it to /usr/lib/libgdbm.so.3.0.0

 ************* WARNING *************

「libgdbm.so」っていうShared Objectが見つかりませんって事ですね。実際に「/usr/lib」ディレクトリには無かったよ。でもね、「libgdbm.so.2」ってのがあった。と言うわけでソフトリンク作成。

 $ ln -s libgdbm.so.2 libgdbm.so


libgdbm.so ・・・ gdbm(GNU DataBase Manager)

GNUデータベースマネージャーの共有ライブラリ版
機能的にndbmと大差ない。

データベースライブラリ

再度、インストール挑戦なんだが、WARNINGがまた発生している。

[warning] mod_perl dso library will be built as mod_perl.so
[warning] You'll need to add the following to httpd.conf:
[warning]
[warning]   LoadModule perl_module modules/mod_perl.so
[warning]
[warning] depending on your build, mod_perl might not live in
[warning] the modules/ directory.

[warning] Check the results of
[warning]
[warning]   $ /usr/local/apache2/bin/apxs -q LIBEXECDIR
[warning]
[warning] and adjust the LoadModule directive accordingly.

それでも、「$ perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs」は完了したので、このWARNINGは後からじっくり見ることにした。と言うよりもこれってhttpd.confに書けよとか言ってるね。インストール後の注意事項と見た。その後、「make」を実行したんだが、できない。エラーがでて途中で処理が止まる。

/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status
make[1]: *** [mod_perl.so] エラー 1
make[1]: Leaving directory `/home/knoppix/mod_perl-2.0.4/src/modules/perl'
make: *** [modperl_lib] エラー 2

最初、理解不能だったんだが・・・

/usr/bin/ld: cannot find -lperl

libperlっていうライブラリモジュールが存在しない可能性がある。実際に存在しなかった。

「$ perl Makefile.PL ・・・」で出来上がるMakefileの中身を見てみた。

$ less Makefile | grep libperl*
LIBPERL_A = libperl.a

libperl.aが必要そうだね。mod_perlってのはApacheに組み込まれたPerlの処理系を利用する。

CGI Perl

CGI PerlってのはApachePerlスクリプトを実行する際、ApachePerlの処理系を呼び出して、Perlの処理系に処理をお願いする。そのぶんオーバーヘッドが発生し遅いと言われる。

mod_perl

Perlの処理系をApacheに組み込む事によりApachePerlの処理系を呼び出す手間を省き、かつスクリプトも再コンパイルする必要もなくなり格段に動作が速くなる

って理解でよいの?ん〜まだまだ理解不足のところはあると思うがこんな感じ。ちなみにmod_perlで再コンパイルが必要なくなるのは(Registry)の方ね。

「libperl.a」はPerlコンパイル時にオプションを指定する事によって作成される。仕方ないのでPerlを再コンパイルする予定。もしくは、バージョンを上げる予定。

では