2013-03-04

perl-5.005_04 が make できなくて困る

- 追記 make できました。-

perl-5.005 のテスト環境が欲しかったので、
WinXP に VMware Player と Ubuntu 12.04 をインストール。
perlbrew で perl-5.005_04 をインストールしてみたところ、見事にこける。

Linux とコンパイルに関して、ほとんどわからないので非常に困る。
インストールログのエラー部分はこんな感じ。

makedepend でエラーが出てるので makedepend.SH を修正。
$ diff -u makedepend.SH.orig makedepend.SH
--- makedepend.SH.orig 2004-01-14 05:16:31.000000000 +0900
+++ makedepend.SH 2013-03-03 00:00:00.000000000 +0900
@@ -51,6 +51,10 @@
  ;;
 esac
 
+# Avoid localized gcc/cc messages
+LC_ALL=C
+export LC_ALL
+
 # We need .. when we are in the x2p directory if we are using the
 # cppstdin wrapper script.
 # Put .. and . first so that we pick up the present cppstdin, not
@@ -113,7 +117,7 @@
     *.y) filebase=`basename $file .y` ;;
     esac
     case "$file" in
-    */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
+    */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
     *)   finc= ;;
     esac
     $echo "Finding dependencies for $filebase$_o."
@@ -132,6 +136,7 @@
  -e '/^#.*<builtin>/d' \
  -e '/^#.*<built-in>/d' \
  -e '/^#.*<command line>/d' \
+ -e '/^#.*<command-line>/d' \
  -e '/^#.*"-"/d' \
  -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
  -e 's/^[  ]*#[  ]*line/#/' \


問題は次の miniperlmain.o のエラー。
'bool'型が定義されてないというのは何となくわかるが
ソースコードを修正するのか、
環境設定やコンパイルオプションを修正するのか判断がつかない。

エラーメッセージが日本語だとググれないので "$ LANG=C make" するとこんな感じ。

$ cd /home/user01/perl5/perlbrew/build/perl5.005_04
$ LANG=C make
`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
   CCCMD =  cc -DPERL_CORE -c -I/usr/local/include -O2   
In file included from perl.h:1276:0,
                 from miniperlmain.c:11:
cop.h:218:5: error: unknown type name 'bool'
cop.h:219:5: error: unknown type name 'bool'
....
"unknown type name bool" でググると perlbrew で fix された形跡を発見。
Fixes Configure options for ancient perls by friedo ・ Pull Request #249 ・ gugod/App-perlbrew ・ GitHub
perlbrew は 0.59 なので fix済みのようだけど、やっぱり make できない。

コンパイル環境がおかしいのかと、perl-5.8.9 を試してみたが、あっさりインストール完了。

考えられる状況としては
 ・コンパイルの設定が間違ってる
 ・コンパイラが非対応になった
 ・Ubuntu の環境が特殊
といったところか。

もうちょっと make 周りを理解しないと解決しなさそう。
とりあえず他のディストロでも試さないとダメかな。

- 追記 make できた! -

ついに解決!
何と15年前の ML に答えがありました。

[debian-users:05717] perl_5.004.04 & inn_1.7.2
[debian-users:05722] Re: perl_5.004.04 & inn_1.7.2
[debian-users:05745] Re: perl_5.004.04 & inn_1.7.2
ccflags='-Dbool=char -DHAS_BOOL'
このオプションを指定すればいいらしい。

Configure でうまく設定できなかったので config.sh を直接編集。
#config.sh
-    ccflags='-I/usr/local/include'
+    ccflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
make できたーーーーーーーーーーー!!!!

make test は2つほどこけます。
pragma/constant....FAILED at test 35
lib/db-btree.......Can't locate DB_File.pm in @INC (@INC contains: ../lib) at lib/db-btree.t line 21.
BEGIN failed--compilation aborted at lib/db-btree.t line 21.
FAILED at test 0
Failed 2 test scripts out of 190, 95.79% okay.
"で" な日々(2002年7月上旬)

perl 5.6.1 の compile で、make test の pragma/constant のところで
failed になってしまうのは、LANG を C にすると回避できた。
"$ LANG=C make test" で無事通過。
残りの DB_File.pm は BerkeleyDB 関連で、使わなければ無視してもいいみたい。

ということで "$ make install"。
$ perlbrew use 5.005_04
$ perl -v

This is perl, version 5.005_04 built for i686-linux

Copyright 1987-1999, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

感動した(T T)
ここまでたどり着けたのも、ひとえに先人のお陰です。
ありがとう。


参考リンク

perlbrew - search.cpan.org

[Perl] Debian (lenny) Perl 5.005・5.6.2 インストール失敗 Kawanet Blog II/ウェブリブログ
Mac OS X 10.6(Snow Leopard)にPerl 5.005をインストールする:Kawanet Blog II
Ubuntu8.10にPerl5.005_04をインストール - なんとなく目記
LinuxにPerl5.005_04をインストールする方法(makeで失敗した場合の対処法) - DQNEO起業日記
Perl の make 時に miniperl でエラーになる場合の対処方法 :: drk7jp

[debian-users:05717] perl_5.004.04 & inn_1.7.2
[debian-users:05722] Re: perl_5.004.04 & inn_1.7.2
[debian-users:05745] Re: perl_5.004.04 & inn_1.7.2

1 件のコメント:

  1. The Best 8 casino reviews and real player feedback - Mapyro
    See if the 10 casino reviews 전라북도 출장마사지 have any positive 논산 출장샵 or negative feedback? Then feel free to use 성남 출장마사지 them in the comments! 광주광역 출장샵 Rating: 남양주 출장샵 2.7 · ‎1,425 reviews

    返信削除