How does SpamAssassin find razor?

SA calls razor's perl code directly, thus it looks in perl's @INC. If perl can't find razor, SA can't; if perl can find razor, SA can. This is often a problem about setting PERL5LIB. On a single user install, you may need a line like:

export PERL5LIB=$HOME/lib/perl5/:$HOME/lib/perl5/site_perl/5.8.3/:$PERL5LIB

For much more detail, see SingleUserUnixInstall.

Razor2 check fails with Can't locate object method "new"

This is unfortunately a more common problem than it should be, and it's not directly caused by SpamAssassin but by an unkempt perl installation.

You can see information in bug 2314: which should help you to clean up your installation.

But here's an example that shows the problem:

The machine which had the issue had two versions of Digest::SHA1 "installed". 2.04 which was fully installed, and 2.01 which only had the .pm module files (none of the related XS libraries). The "use lib" in SA caused the 2.01 pm module to be loaded, but the only XS libraries perl could find was 2.04, which caused DynaLoader to throw errors.

To see the problem, you can run this command:

$ perl -e 'use lib "/usr/lib/perl5/site_perl/5.6.0"; use Razor2::Client::Agent;'

changing the path as appropriate to whatever SA's install is set to (look in the "spamassassin" script).

The error that came out was:

Digest::SHA1 object version 2.04 does not match bootstrap parameter 2.01 at /usr/lib/perl5/5.6.0/ppc-linux/ line 219.
Compilation failed in require at /usr/lib/perl5/site_perl/5.6.0/ppc-linux/Razor2/ line 4.

Looking around the directories then showed the PM/XS issues as described above. The solution was to remove all Digest::SHA1 related files, reinstall 2.04, then try the above perl commandline again, which now worked fine.

RazorCantLocateNew (last edited 2009-09-20 23:17:00 by localhost)