Perl 5.10.1 on Synology NAS

Synology’s NAS come with Perl 5.8, and optware does not have a 5.10 build either. To compile 5.10.1, here’s what I had to do:

  • Make sure the optware lib directory is used, to avoid errors like “undefined reference to `floor'”:
    $ sh Configure -Dplibpth=/opt/powerpc-linux-gnuspe/lib /lib /usr/lib -de
  • As a hack to avoid the “No error definitions found at Errno_pm.PL, Iine 228” error, I simply commented the “die” statement on that line. As a result, the Errno module is presumably not going to work.

To install packages from CPAN, I’m using the cpanm client. However, it has currently a bug where it calls “tar” with a syntax not supported by the tar version you find on your Synology NAS, so to install it, we actually need to do:

$ wget
$ tar xzf App-cpanminus-1.4004.tar.gz
$ cd App-cpanminus-1.4004/
$ /usr/local/bin/perl Makefile.PL
$ make && make install

Then, open /usr/local/bin/cpanm, and make the following changes, in sub init_tools:

  • line 1944, my($root, @others) = `$tar tf$ar $tarfile` to my($root, @others) = `$tar ${ar}tf $tarfile`
  • line 1951, system “$tar $xf$ar $tarfile”; to system “$tar $ar$xf $tarfile”;

Now we can install packages:
$ /usr/local/bin/perl /usr/local/bin/cpanm HTTP::Request

Occasionally, to install certain modules or use Perl scripts that use those modules, you need to include the optware lib directory:

$ LD_LIBRARY_PATH=/opt/lib /usr/local/bin/perl /usr/local/bin/cpanm Crypt::OpenSSL::RSA

1 thought on “Perl 5.10.1 on Synology NAS

  1. Regarding your Errno Hack: It’s a well known cross-compile Bug in Errno_pm.PL, which has hardcoded paths for the errno.h include. Search for “linux” in Errno_pm.PL and change the path from /usr/include to /opt/include. Errno_pm.PL will now compile properly. Or if you do not want to change the source just create a symlink in /usr/include.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s