freebsd 8.2下防垃圾邮件插件spamassassin提示Can’t locate Mail/SpamAssassin/CompiledRegexps/body_0.pm in @INC

本笔记记录freebsd8.2版本下ports方案安装防垃圾邮件插件spamassassin后maillog提示Can’t locate Mail/SpamAssassin/CompiledRegexps/body_0.pm in @INC (@INC contains:/var/db/spamassassin/compiled/5.008/3.003001 /var/db/spamassassin/compiled/5.008/3.003001/auto lib /usr/local/lib/perl5/site_perl/5.8.9 /usr/local/lib/perl5/5.8.9/BSDPAN /usr/local/lib/perl5/site_perl/5.8.9/mach /usr/local/lib/perl5/5.8.9/mach /usr/local/lib/perl5/5.8.9) at (eval 933) line 1.错误信息的解决方案。本笔记虽然是在FreeBSD8.2系统上测试通过,其中多数内容也适合各个Linux发行版本以及各个BSD分支,在其他系统上只需要做少量调整。

提示以下错误信息:

[[email protected] ~]# more /var/log/maillog
Jul 22 16:17:48 bak spamd[1508]: spamd: server killed by SIGTERM, shutting down
Jul 22 16:17:49 bak spamd[2211]: logger: removing stderr method
Jul 22 16:17:51 bak spamd[2213]: Can't locate Mail/SpamAssassin/CompiledRegexps/body_0.pm in @INC (@INC contains:/var/db/spamassassin/compiled/5.008/3.003001 /var/db/spamassassin/compiled/5.008/3.003001/auto lib /usr/local/lib/perl5/site_perl/5.8.9 /usr/local/lib/perl5/5.8.9/BSDPAN /usr/local/lib/perl5/site_perl/5.8.9/mach /usr/local/lib/perl5/5.8.9/mach /usr/local/lib/perl5/5.8.9) at (eval 933) line 1.
Jul 22 16:18:03 bak spamd[2213]: spamd: server started on port 783/tcp (running version 3.3.1)
Jul 22 16:18:03 bak spamd[2213]: spamd: server pid: 2213
Jul 22 16:18:03 bak spamd[2213]: spamd: server successfully spawned child process, pid 2216
Jul 22 16:18:03 bak spamd[2213]: spamd: server successfully spawned child process, pid 2217
Jul 22 16:18:03 bak spamd[2213]: prefork: child states: SI
Jul 22 16:18:03 bak spamd[2213]: prefork: child states: II

解决方案:
(1)执行spamassassin –lint命令,直到没有出错了;

[[email protected] ~]#spamassassin --lint

(2)执行sa-compile命令

[[email protected] ~]#sa-compile

这时会提示类似以下信息:

Jul 22 16:27:17.272 [2274] info: generic: base extraction starting. this can take a while...
Jul 22 16:27:17.273 [2274] info: generic: extracting from rules of type body_0
100% [===========================================] 1092.60 rules/sec 00m00s DONE
100% [===========================================] 286.96 bases/sec 00m09s DONE
Jul 22 16:27:27.235 [2274] info: body_0: 982 base strings extracted in 10 seconds
cd /tmp/.spamassassin2274EWgChXtmp
cd Mail-SpamAssassin-CompiledRegexps-body_0
re2c -i -b -o scanner1.c scanner1.re
re2c -i -b -o scanner2.c scanner2.re
re2c -i -b -o scanner3.c scanner3.re
re2c -i -b -o scanner4.c scanner4.re
re2c -i -b -o scanner5.c scanner5.re
/usr/local/bin/perl5.8.9 Makefile.PL PREFIX=/tmp/.spamassassin2274EWgChXtmp/ignored INSTALLSITEARCH=/var/db/spamassassin/compiled/5.008/3.003001
Writing Makefile for Mail::SpamAssassin::CompiledRegexps::body_0
make
cp body_0.pm blib/lib/Mail/SpamAssassin/CompiledRegexps/body_0.pm
/usr/local/bin/perl5.8.9 /usr/local/lib/perl5/site_perl/5.8.9/ExtUtils/xsubpp  -typemap /usr/local/lib/perl5/5.8.9/ExtUtils/typemap  body_0.xs > body_0.xsc && mv body_0.xsc body_0.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   body_0.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   scanner1.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   scanner2.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   scanner3.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   scanner4.c
cc -c    -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O2 -pipe -fno-strict-aliasing    -DVERSION="1.0"  -DXS_VERSION="1.0" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/mach/CORE"   scanner5.c
Running Mkbootstrap for Mail::SpamAssassin::CompiledRegexps::body_0 ()
chmod 644 body_0.bs
rm -f blib/arch/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so
cc  -shared  -L/usr/local/lib body_0.o  scanner1.o  scanner2.o  scanner3.o  scanner4.o  scanner5.o  -o blib/arch/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so          
chmod 755 blib/arch/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so
cp body_0.bs blib/arch/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.bs
chmod 644 blib/arch/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.bs
Manifying blib/man3/Mail::SpamAssassin::CompiledRegexps::body_0.3
make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /var/db/spamassassin/compiled/5.008/3.003001/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so
Installing /var/db/spamassassin/compiled/5.008/3.003001/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.bs
Installing /var/db/spamassassin/compiled/5.008/3.003001/Mail/SpamAssassin/CompiledRegexps/body_0.pm
Installing /tmp/.spamassassin2274EWgChXtmp/ignored/lib/perl5/5.8.9/man/man3/Mail::SpamAssassin::CompiledRegexps::body_0.3
FreeBSD: Registering installation in the package database
Appending installation info to /tmp/.spamassassin2274EWgChXtmp/ignored/lib/perl5/5.8.9/mach/perllocal.pod
cp /tmp/.spamassassin2274EWgChXtmp/bases_body_0.pl /var/db/spamassassin/compiled/5.008/3.003001/bases_body_0.pl
cd /
rm -rf /tmp/.spamassassin2274EWgChXtmp

最后,重动sa-spamd,OK!

[[email protected] ~]#/usr/local/etc/rc.d//usr/local/etc/rc.d/sa-spamd restart