Archive for the ‘Perl’ Category

I recently updated the kernel on our mailserver and found that spamassassin would no longer run. I was getting an error message something like this:

Errno architecture (i386-linux-thread-multi-2.6.9-78.0.1.elsmp) does not match executable architecture (i386-linux-thread-multi-2.6.18-128.1.1.el5) at /usr/lib/perl5/site_perl/5.8.8/Errno.pm line 11.
Compilation failed in require at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/IO/Socket.pm line 17.
BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/IO/Socket.pm line 17.
Compilation failed in require.
BEGIN failed--compilation aborted.

The solution was to get rid of everything that I installed with cpan. That means I just renamed /usr/lib/perl5/site_perl to something else and remade the site_perl directory with the following files:

/usr/lib/perl5/site_perl
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto
/usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi/auto
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto

After that, spamassassin started with no problems.

So, how to install other cpan modules without using cpan? (Since it can cause problems.) I added the Dag repository (http://dag.wieers.com/) to my setup. Just create a file /etc/yum.repos.d/dag.repo with the following:

#
# DAG (http://dag.wieers.com) additional RPMS repository
#
[main]
[dag]
name=DAG (http://dag.wieers.com) additional RPMS repository
baseurl=http://linuxsoft.cern.ch/dag/redhat/el4/en/$basearch/dag
gpgkey=http://linuxsoft.cern.ch/cern/slc4X/$basearch/docs/RPM-GPG-KEY-dag
gpgcheck=1
enabled=1

They actually have rpms for a lot of the modules. Then, I can simply run:

yum install perl-File-Find-Rule

If, either when running a perl program or when trying to update cpan, you get an error like this:

Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar/Util.pm line 30.

You’ve probably screwed up the Scalar Util stuff. Reinstall a new one from source.

wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/Scalar-List-Utils-1.19.tar.gz
tar xvzf Scalar-List-Utils-1.19.tar.gz
cd Scalar-List-Utils-1.19
perl Makefile.PL
make
make test
make install

That fixed things for me.