先将SA依赖组件安装好后,进行编译安装:
[root@mail Mail-SpamAssassin-3.4.1]# /usr/local/perl5/bin/perl Makefile.PL PREFIX=/usr/local/spamassassin CONTACT_ADDRESS="postmaster.zjtxt.com" DATADIR=/data/mail/spamassassin [root@mail Mail-SpamAssassin-3.4.1]# make
编译时会报如下错误:
.. "/usr/local/perl5/bin/perl" spamc/configure.pl --prefix="/usr/local/spamassassin" --sysconfdir="/usr/local/spamassassin/etc/mail/spamassassin" --datadir="/data/mail/spamassassin" --enable-ssl="no" cd spamc /usr/local/perl5/bin/perl version.h.pl do "version.h.pl" failed, '.' is no longer in @INC; did you mean do "./version.h.pl"? at spamc/configure.pl line 72. spamc/configure.pl: Can't exec `version.h.pl': No such file or directory at spamc/configure.pl line 74. make: *** [spamc/Makefile] 错误 2 [root@mail Mail-SpamAssassin-3.4.1]#
提示找不到文件,可此文件确实存在:
[root@mail Mail-SpamAssassin-3.4.1]# ls spamc/version.h.pl spamc/version.h.pl [root@mail Mail-SpamAssassin-3.4.1]#
经过查找,很多人都出现过此问题,后在此网站上找到解决方法。
按其提示,修改spamc/configure.pl源文件,忽略version.h的存在检查:
[root@mail Mail-SpamAssassin-3.4.1]# vim +74 spamc/configure.pl
# Create version.h platform independently. print join(' ', $Config{'perlpath'}, "version.h.pl") . "\n"; { # Do the same thing as for the preprocessor below. package version_h; my $Z = $0; local $0 = "version.h.pl"; local @ARGV = (); # Got to check for defined because the script returns shell error level! unless (defined do $0) { # $0 = $Z; # die $@ ? $@ : "Can't exec `version.h.pl': $!"; $0 = "/usr/local/src/Mail-SpamAssassin-3.4.1/spamc/version.h.pl"; $Z = $0; $Z; } }
上面一段的工作本来是要创建spamc/version.h文件,现在需要手工创建:
[root@mail Mail-SpamAssassin-3.4.1]# ls spamc/version.h
/* version.h. Generated by version.h.pl. */ /* version.h.in. template for version.h.pl, called from configure.pl. */ #define VERSION_STRING "3.4.1"
然后即可正常编译安装:
[root@mail Mail-SpamAssassin-3.4.1]# make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install
This can be fixed by allowing insecure paths in perl while building the program. Set PERL_USE_UNSAFE_INC=1 in the enviornment/shell