Perl Module
Home Up thttpd Web Server Cherokee web CRON+SSMTP Samba Velleman K8055 Perl Module GD in Perl Native

 

Preparation for installing Perl modules

There are a large number of Perl modules available, and only a small proportion of these are included in the package feed for OpenSlug. If the package you want is not in the feed you will probably have to download and install it manually.

Modules are normally made available as gzip compressed "tar" archives with the file extension ".gz"

Modules fall into two categories:

  1. Pure Perl modules, e.g. modules that consist of only Perl code.
  2. Modules that link to code written in another language, usually C/C++

Pure modules usually install without issues, however modules with code require some work before they will install.

Making changes to the perl install to allow modules to be compiled.

  1. Add a copy of xsubpp to /usr/lib/perl5/5.8.7/ExtUtils
  2. Add a copy of typemap to /usr/lib/perl5/5.8.7/ExtUtils
  3. Edit /usr/lib/perl5/5.8.7/armeb-linux/Config.pm to fix a compiler issue.

xsubpp and typemap:

Here's an example of using wget to fetch the files directly into the folder where they are required.

root@testbox:~#
root@testbox:~# cd /usr/lib/perl5/5.8.7/ExtUtils
root@testbox:/usr/lib/perl5/5.8.7/ExtUtils# wget http://www.boristheengineer.co.uk/slug/download/typemap
--18:49:21--  http://www.boristheengineer.co.uk/slug/download/typemap
           => `typemap'
Resolving www.boristheengineer.co.uk... 
Connecting to www.boristheengineer.co.uk[-]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6,810 [text/plain]
100%[====================================>] 6,810         --.--K/s
18:49:22 (113.03 KB/s) - `typemap' saved [6810/6810]
root@testbox:/usr/lib/perl5/5.8.7/ExtUtils# wget http://www.boristheengineer.co.uk/slug/download/xsubpp
--18:49:36--  http://www.boristheengineer.co.uk/slug/download/xsubpp
           => `xsubpp'
Resolving www.boristheengineer.co.uk... 
Connecting to www.boristheengineer.co.uk[-]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 51,745 [text/plain]
100%[====================================>] 51,745       200.31K/s
18:49:36 (199.95 KB/s) - `xsubpp' saved [51745/51745]
root@testbox:/usr/lib/perl5/5.8.7/ExtUtils# cd
root@testbox:~#

These are two files that were left out of the openslug perl distribution. It is understandable that they would be left out as they are mainly used for creating perl packages but unfortunately they are needed to install some of the more complex modules. I obtained replacements from my perl 5.8.8 test installation. 

It is difficult to extract the files from perl source so here are the ones from my 5.8.8 build: xsubpp typemap

The version mismatch between 5.8.7 and 5.8.8 is not a problem but if perl advances to version 5.9 or 6.0 then newer files should be obtained.

Config.pm

Config.pm contains information on the tool chain (the c compiler) used to build perl. Some extensions include C code and the code must be compiled with the same compiler as built the main perl executable. Perl was cross-compiled on a PC, so Config.pm contains a reference to a tool called ccache which is not present on openslug. The purpose of ccache is to speed up compilation so it is not actually required but  while it is referenced in Config.pm the package will look for it and fail.

Find Config.pm in /usr/lib/perl5/5.8.7/armeb-linux

Find the line in Config.pm that reads as follows:

tie %Config, 'Config', {
archlibexp => '/usr/lib/perl5/5.8.7/armeb-linux',
archname => 'armeb-linux',
cc => 'ccache armeb-linux-gcc -march=armv5te -mtune=xscale -mthumb-interwork -mno-thumb',
d_readlink => 'define',
d_symlink => 'define',
dlsrc => 'dl_dlopen.xs',

Edit out "ccache" so that line reads:

cc => 'armeb-linux-gcc -march=armv5te -mtune=xscale -mthumb-interwork -mno-thumb',

Take care not to alter anything else. Now you've replaced the missing files and fixed the toolchain you can install the module.

Alternatively you could install ccache

If you already tried and failed to install a module you should probably run "make clean" to clear out the failed attempt before rerunning "perl Makefile.PL" etc.

CPAN

The CPAN shell provides a way to automatically download and install Perl modules. The modules are obtained from the Comprehentive Perl Archive Network and the shell will recursively install any modules that the requested module depends on.

The CPAN shell needs some adjustment before it will work on Openslug.

CCACHE

I've seen instructions for adding "ccache" to an openslug system. Its available at http://ccache.samba.org/ and the latest appears to be version 2.4

wget http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz
tar zxvf http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz
cd ccache-2.4
./configure
make
make install

 

 

Home Up thttpd Web Server Cherokee web CRON+SSMTP Samba Velleman K8055 Perl Module GD in Perl Native