PERLSYNOLOGY(1perl)

πŸ“¦
version 5.44.0 Β· 2 versions
, in arch rolling

πŸ¦‹ PERLSYNOLOGY(1perl) πŸ¦‹

okay so bestie, welcome to the Perl Programmers Reference Guide's very own page about running Perl 5 on Synology DSM systems πŸ’–. This is genuinely a whole saga, so grab a snack πŸ“, and let's get into it. Everything here is real, nothing is skipped, and yes we are reading the entire thing together. Periodt.


✨ NAME ✨

perlsynology β€” Perl 5 on Synology DSM systems πŸ‘‘


🌸 DESCRIPTION 🌸

okay so picture this: Synology makes a vast number of Network Attached Storage (NAS) devices, and they are super popular β€” like, in large organisations, in small businesses, and in people's homes. Everywhere. Iconic behaviour honestly. πŸ’…

These NAS systems come with Synology Disk Storage Manager (DSM), which is basically a trimmed-down Linux system that's been upgraded with a bunch of tools for managing the NAS. And the hardware? So many flavours, not me listing them: Marvell Armada (ARMv5tel, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ (PPC), and more. For the full list, hit up the Synology FAQ <https://kb.synology.com/en-global/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have>. 🧚

Since it's Linux-based, your NAS can run tons of popular Linux software packages, Perl included. In fact, Synology ships a ready-to-install package for Perl, and depending on which DSM version you're on, the installed perl ranges from 5.8.6 on DSM-4.3 all the way to 5.28.1 on DSM-7.1. 🌈

There's also a very active user community serving up lots of software packages for Synology DSM systems, and at the time this document was written, they provide Perl version 5.28.1.

So this doc describes the various features of the Synology DSM operating system that affect how Perl 5 (from here on out, just Perl) gets configured, compiled and/or run. It was compiled and verified by Johan Vromans for the Synology DS413 (QorIQ), with feedback from H.Merijn Brand (DS213: ARMv5tel, RS815: Intel Atom x64, and DS218+: Celeron J3355). Teamwork, fr fr 🫢


πŸ› οΈ Setting up the build environment

DSM 7

For a comfortable development environment, Entware is currently the only viable solution, no cap. Just follow the detailed instructions on Install Entware on Synology NAS <https://github.com/Entware/Entware/wiki/Install-on-Synology-NAS>. The supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and x86_64. Check here <https://pkg.entware.net/binaries/> for supported platforms. πŸ‘€

That github link also shows what environments should be supported.

It was tested on DSM-7.1 by H.Merijn Brand on a DS218+ and a DS220+ (both Intel x64). πŸ”₯

Entware comes with a precompiled 5.26.1 (Jan 2018) that allows building shared XS code. Note that this installation does not use a site_perl folder. The available cpan works. And if all the required development packages are installed too, so does XS. πŸ’ͺ

Installing perl from the Community package center:

  • Using your favourite browser, open the DSM management page and start the Package Center.
  • In Settings, add the following Package Sources:
Name:     Community
Location: https://synopackage.com/repository/spk/All
  • Still in Settings, in Channel Update, select Beta Channel.

To complete the development environment, install make and gcc:

ds220# opkg install make gcc

Then, optionally, make sure you use the more recent bash and gawk.

ds220# opkg install bash gawk
ds220# cd /usr/bin
ds220# mv bash bash.syno
ds220# ln -s /opt/bin/bash .

In order to have Configure find the required libraries:

ds220# cd /opt/lib
ds220# ln -s libcrypt.so.?       libcrypt.so
ds220# ln -s libdl.so.?          libdl.so
ds220# ln -s libgdbm.so.?        libgdbm.so
ds220# ln -s libgdbm_compat.so.? libgdbm_compat.so
ds220# ln -s libm.so.?           libm.so
ds220# ln -s libpthread.so.?     libpthread.so
ds220# ln -s libutil.so.?        libutil.so

DSM 6

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 <https://pkg.entware.net/binaries/> for supported platforms.

Entware-ng comes with a precompiled 5.24.1 (June 2017) that allows building shared XS code. Note that this installation does not use a site_perl folder. The available cpan works. And if all the required development packages are installed too, so does XS.

DSM 5

Since DSM is a trimmed-down Linux system, it lacks many of the tools and libraries you'd normally find on Linux. The basic tools like sh, cp, rm, etc. are implemented using BusyBox <https://en.wikipedia.org/wiki/BusyBox>. (Budget tools, but they work πŸ’€)

  • Using your favourite browser, open the DSM management page and start the Package Center.
  • If you want to smoke test Perl, install Perl.
  • In Settings, add the following Package Sources:
https://www.cphub.net
http://packages.quadrat4.de

As these two are both discontinued, it is unlikely you will be able to set up a build environment on DSM 5. πŸ™ˆ

  • Still in Settings, in Channel Update, select Beta Channel.
  • Press Refresh. In the left panel the item Community will appear. Click it. Select Bootstrap Installer Beta and install it.
  • Likewise, install iPKGui Beta.

The application window should now show an icon for iPKGui.

  • Start iPKGui. Install the packages make, gcc and coreutils.

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 expects a library libm.so that normally is a symlink to libm.so.6. Synology only provides the latter and not the symlink. Classic. 😀

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, powerpc-linux-gnuspe is used as an example.

  • On the DSM management page, start the Control Panel.
  • Click Terminal, and enable SSH service.
  • Close Terminal and the Control Panel.
  • Open a shell on the Synology using ssh and become root.
  • Execute the following commands:
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. Mark your calendar bestie, they're not coming back on their own.

🧱 Compiling Perl 5

Once the build environment is set up, building and testing Perl is straightforward. The only thing you need to do is download the sources as usual, and add a file Policy.sh as follows:

# Administrivia.
perladmin="your.email@goes.here"

# 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
# on older DSM versions
cc=gcc
awk=/opt/bin/gawk

# Build flags. Optional
ccflags="-DDEBUGGING"

# Library and include paths.
locincpth="/opt/include"
loclibpth="/opt/lib /usr/local/lib /usr/lib"
libpth="/opt/lib /usr/local/lib /usr/lib"

You may want to create the destination directory and give it the right permissions before installing, which eliminates the need to build Perl as a super user. Efficiency, we love her. πŸ‘‘

In the directory where you unpacked the sources, issue the familiar commands:

$ bash ./Configure -Dusedevel -Duseshrplib -Duse64bitall -des
$ make -j2
$ env TEST_JOBS=2 make test_harness
$ make install

😭 Known problems

Configure

The GNU C-compiler might spit out unexpected stuff under -v, which causes the analysis of cppsymbols to fail because of unmatched quotes.

You'll note if config.sh fails with a syntax error.

Build

Error message "No error definitions found".

This error is generated when it is not possible to find the local definitions for error codes, due to the uncommon structure of the Synology file system.

This error was fixed in the Perl development git for version 5.19, commit 7a8f1212e5482613c8a5b0402528e3105b26ff24.

Failing tests

ext/DynaLoader/t/DynaLoader.t

One subtest fails due to the uncommon structure of the Synology file system. The file /lib/glibc.so is missing.

⚠️ WARNING: Do not symlink /lib/glibc.so.6 to /lib/glibc.so or some system components will start to fail. Do not do it. I am begging. πŸ™

πŸ’¨ Smoke testing Perl

If building completes successfully, you can set up smoke testing as described in the Test::Smoke documentation.

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

πŸŽ€ Local patches

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.


πŸ“ Adding libraries

The above procedure describes a basic environment and hence results in a basic Perl. If you want to add additional libraries to Perl, you may need some extra settings.

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. Both times, bestie. Don't forget the second one. πŸ’œ


πŸ“… REVISION

July 2022, for DSM 5.1.5022 and DSM 6.1-15101-4, and DSM-7.1-42661-3.


πŸ‘‘ AUTHOR

Johan Vromans <jvromans@squirrel.nl> H. Merijn Brand <cpan@tux.freedom.nl>


and that's the whole page, you made it to the end πŸŽ‰πŸ«Ά huge main character energy. This lil' rewrite was handcrafted from perl v5.44.0, dated 2026-10-17, and it lives as PERLSYNOLOGY(1perl) inside the Perl Programmers Reference Guide. bye bestie, go build something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms