安装perl5.6
【背景】因为CentOS6.1系统里perl默认的版本是v5.10.1,但是想用的是perl5.6.0。这样的话需要自己手动编译安装。编译过程中遇到了一些问题,这里稍微整理了一下。
【环境】 CentOS6.1
【安装步骤】
1)下载
[root@demo misc]# wget http://www.cpan.org/src/5.0/perl-5.6.0.tar.gz
2) 解压
[root@demo misc]# tar zxvf perl-5.6.0.tar.gz
[root@demo misc]# cd
perl-5.6.0
3)安装
3.1) 执行Configure
[root@demo perl-5.6.0]# sh Configure -des
-Dprefix=/opt/compiled/perl/perl5.6.0 -Dusethreads
First let's make sure your
kit is complete. Checking...
3.2) 执行make
[root@demo perl-5.6.0]# make
make失败了,产生了下面的错误
make: *** No rule to make target `<built-in>',
needed by `miniperlmain.o'. Stop.
或者make: *** No rule to make target
`<command-line>', needed by `miniperlmain.o'. Stop.
这个错误时因为依赖的编译文件makedepend.SH中存在bug,需要手动修改一下:
[root@demo perl-5.6.0]# cp makedepend.SH makedepend.SH.original
[root@demo
perl-5.6.0]# vi makedepend.SH
在139行之后增加2句话并强制保存。
-e '/^#.*<built-in>/d' \
-e
'/^#.*<command-line>/d' \
修改完后,diff一下可以看到修改的地方
[root@demo perl-5.6.0]# diff makedepend.SH
makedepend.SH.original
140,141d139
< -e
'/^#.*<built-in>/d' \
< -e '/^#.*<command-line>/d'
\
继续make,又出现一个错误,缺少一个头文件asm/page.h。
[root@demo perl-5.6.0]# make
SysV.xs:7:25: error: asm/page.h: No such file
or directory
make[1]: *** [SysV.o] Error 1
找到头文件,链接至include目录中,然后继续make。
[root@demo perl-5.6.0]# ln -s /usr/src/linux/include/asm/page.h /usr/include/asm/
[root@demo perl-5.6.0]# make
3.3) 安装
[root@demo perl-5.6.0]# make install
3.4) 确认
[root@demo perl-5.6.0]# /opt/compiled/perl/perl5.6.0/bin/perl -v
This is perl, v5.6.0 built for i686-linux-thread-multi
Copyright 1987-2000, 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.