|PERLSYNOLOGY(1)||Perl Programmers Reference Guide||PERLSYNOLOGY(1)|
The NAS systems are equipped with Synology Disk Storage Manager (DSM), which is a trimmed-down Linux system enhanced with several tools for managing the NAS. There are several flavours of hardware: Marvell Armada (ARMv5tel, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ (PPC), and more. For a full list see the Synology FAQ <http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have>.
Since it is based on Linux, the NAS can run many popular Linux software packages, including Perl. In fact, Synology provides a ready-to-install package for Perl, depending on the version of DSM the installed perl ranges from 5.8.6 on DSM-4.3 to 5.24.0 on DSM-6.1.
There is an active user community that provides many software packages for the Synology DSM systems; at the time of writing this document they provide Perl version 5.24.1.
This document describes various features of Synology DSM operating system that will affect how Perl 5 (hereafter just Perl) is configured, compiled and/or runs. It has been compiled and verified by Johan Vromans for the Synology DS413 (QorIQ), with feedback from H.Merijn Brand (DS213, ARMv5tel and RS815, Intel Atom x64).
As DSM is a trimmed-down Linux system, it lacks many of the tools and libraries commonly found on Linux. The basic tools like sh, cp, rm, etc. are implemented using BusyBox <http://en.wikipedia.org/wiki/BusyBox>.
The application window should now show an icon for iPKGui.
If you want to smoke test Perl, install "patch".
The next step is to add some symlinks to system libraries. For example, the development software expect a library "libm.so" that normally is a symlink to "libm.so.6". Synology only provides the latter and not the symlink.
Here the actual architecture of the Synology system matters. You have to find out where the gcc libraries have been installed. Look in /opt for a directory similar to arm-none-linux-gnueab or powerpc-linux-gnuspe. In the instructions below I'll use powerpc-linux-gnuspe as an example.
cd /lib ln -s libm.so.6 libm.so ln -s libcrypt.so.1 libcrypt.so ln -s libdl.so.2 libdl.so cd /opt/powerpc-linux-gnuspe/lib (or /opt/arm-none-linux-gnueabi/lib) ln -s /lib/libdl.so.2 libdl.so
WARNING: When you perform a system software upgrade, these links will disappear and need to be re-established.
Using iPkg has been deprecated on DSM 6, but an alternative is available for DSM 6: entware/opkg. For instructions on how to use that, please read Install Entware-ng on Synology NAS <https://github.com/Entware-ng/Entware-ng/wiki/Install-on-Synology-NAS>
That sadly does not (yet) work on QorIQ. At the moment of writing, the supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and x86_64. Check here <http://pkg.entware.net/binaries/> for supported platforms.
Entware-ng comes with a precompiled 5.24.1 (June 2017) that allowes building shared XS code. Note that this installation does not use a site_perl folder. The available "cpan" works. If all required development packages are installed too, also for XS.
# Administrivia. perladmin="firstname.lastname@example.org" # Install Perl in a tree in /opt/perl instead of /opt/bin. prefix=/opt/perl # Select the compiler. Note that there is no 'cc' alias or link. cc=gcc # Build flags. ccflags="-DDEBUGGING" # Library and include paths. libpth="/lib" locincpth="/opt/include" loclibpth="/lib"
You may want to create the destination directory and give it the right permissions before installing, thus eliminating the need to build Perl as a super user.
In the directory where you unpacked the sources, issue the familiar commands:
./Configure -des make make test make install
No known problems yet
This error was fixed in the Perl development git for version 5.19, commit 7a8f1212e5482613c8a5b0402528e3105b26ff24.
WARNING: Do not symlink /lib/glibc.so.6 to /lib/glibc.so or some system components will start to fail.
For smoke testing you need a running Perl. You can either install the Synology supplied package for Perl 5.8.6, or build and install your own, much more recent version.
Note that I could not run successful smokes when initiated by the Synology Task Scheduler. I resorted to initiating the smokes via a cron job run on another system, using ssh:
ssh nas1 wrk/Test-Smoke/smoke/smokecurrent.sh
When local patches are applied with smoke testing, the test driver will automatically request regeneration of certain tables after the patches are applied. The Synology supplied Perl 5.8.6 (at least on the DS413) is NOT capable of generating these tables. It will generate opcodes with bogus values, causing the build to fail.
You can prevent regeneration by adding the setting
'flags' => 0,
to the smoke config, or by adding another patch that inserts
exit 0 if $] == 5.008006;
in the beginning of the "regen.pl" program.
For example, the basic Perl does not have any of the DB libraries (db, dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to set environment variable LD_LIBRARY_PATH to the appropriate value:
LD_LIBRARY_PATH=/lib:/opt/lib export LD_LIBRARY_PATH
This setting needs to be in effect while Perl is built, but also when the programs are run.