1PERLSYNOLOGY(1) Perl Programmers Reference Guide PERLSYNOLOGY(1)
2
3
4
6 perlsynology - Perl 5 on Synology DSM systems
7
9 Synology manufactures a vast number of Network Attached Storage (NAS)
10 devices that are very popular in large organisations as well as small
11 businesses and homes.
12
13 The NAS systems are equipped with Synology Disk Storage Manager (DSM),
14 which is a trimmed-down Linux system enhanced with several tools for
15 managing the NAS. There are several flavours of hardware: Marvell
16 Armada (ARMv5tel, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ
17 (PPC), and more. For a full list see the Synology FAQ
18 <https://kb.synology.com/en-
19 global/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have>.
20
21 Since it is based on Linux, the NAS can run many popular Linux software
22 packages, including Perl. In fact, Synology provides a ready-to-install
23 package for Perl, depending on the version of DSM the installed perl
24 ranges from 5.8.6 on DSM-4.3 to 5.24.0 on DSM-6.1.
25
26 There is an active user community that provides many software packages
27 for the Synology DSM systems; at the time of writing this document they
28 provide Perl version 5.24.1.
29
30 This document describes various features of Synology DSM operating
31 system that will affect how Perl 5 (hereafter just Perl) is configured,
32 compiled and/or runs. It has been compiled and verified by Johan
33 Vromans for the Synology DS413 (QorIQ), with feedback from H.Merijn
34 Brand (DS213, ARMv5tel and RS815, Intel Atom x64).
35
36 Setting up the build environment
37 DSM 5
38
39 As DSM is a trimmed-down Linux system, it lacks many of the tools and
40 libraries commonly found on Linux. The basic tools like sh, cp, rm,
41 etc. are implemented using BusyBox
42 <https://en.wikipedia.org/wiki/BusyBox>.
43
44 • Using your favourite browser open the DSM management page and start
45 the Package Center.
46
47 • If you want to smoke test Perl, install "Perl".
48
49 • In Settings, add the following Package Sources:
50
51 https://www.cphub.net
52 http://packages.quadrat4.de
53
54 • Still in Settings, in Channel Update, select Beta Channel.
55
56 • Press Refresh. In the left panel the item "Community" will appear.
57 Click it. Select "Bootstrap Installer Beta" and install it.
58
59 • Likewise, install "iPKGui Beta".
60
61 The application window should now show an icon for iPKGui.
62
63 • Start iPKGui. Install the packages "make", "gcc" and "coreutils".
64
65 If you want to smoke test Perl, install "patch".
66
67 The next step is to add some symlinks to system libraries. For example,
68 the development software expect a library "libm.so" that normally is a
69 symlink to "libm.so.6". Synology only provides the latter and not the
70 symlink.
71
72 Here the actual architecture of the Synology system matters. You have
73 to find out where the gcc libraries have been installed. Look in /opt
74 for a directory similar to arm-none-linux-gnueab or powerpc-linux-
75 gnuspe. In the instructions below I'll use powerpc-linux-gnuspe as an
76 example.
77
78 • On the DSM management page start the Control Panel.
79
80 • Click Terminal, and enable SSH service.
81
82 • Close Terminal and the Control Panel.
83
84 • Open a shell on the Synology using ssh and become root.
85
86 • Execute the following commands:
87
88 cd /lib
89 ln -s libm.so.6 libm.so
90 ln -s libcrypt.so.1 libcrypt.so
91 ln -s libdl.so.2 libdl.so
92 cd /opt/powerpc-linux-gnuspe/lib (or
93 /opt/arm-none-linux-gnueabi/lib)
94 ln -s /lib/libdl.so.2 libdl.so
95
96 WARNING: When you perform a system software upgrade, these links will
97 disappear and need to be re-established.
98
99 DSM 6
100
101 Using iPkg has been deprecated on DSM 6, but an alternative is
102 available for DSM 6: entware/opkg. For instructions on how to use that,
103 please read Install Entware-ng on Synology NAS
104 <https://github.com/Entware-ng/Entware-ng/wiki/Install-on-Synology-NAS>
105
106 That sadly does not (yet) work on QorIQ. At the moment of writing, the
107 supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and
108 x86_64. Check here <https://pkg.entware.net/binaries/> for supported
109 platforms.
110
111 Entware-ng comes with a precompiled 5.24.1 (June 2017) that allowes
112 building shared XS code. Note that this installation does not use a
113 site_perl folder. The available "cpan" works. If all required
114 development packages are installed too, also for XS.
115
116 Compiling Perl 5
117 When the build environment has been set up, building and testing Perl
118 is straightforward. The only thing you need to do is download the
119 sources as usual, and add a file Policy.sh as follows:
120
121 # Administrivia.
122 perladmin="your.email@goes.here"
123
124 # Install Perl in a tree in /opt/perl instead of /opt/bin.
125 prefix=/opt/perl
126
127 # Select the compiler. Note that there is no 'cc' alias or link.
128 cc=gcc
129
130 # Build flags.
131 ccflags="-DDEBUGGING"
132
133 # Library and include paths.
134 libpth="/lib"
135 locincpth="/opt/include"
136 loclibpth="/lib"
137
138 You may want to create the destination directory and give it the right
139 permissions before installing, thus eliminating the need to build Perl
140 as a super user.
141
142 In the directory where you unpacked the sources, issue the familiar
143 commands:
144
145 ./Configure -des
146 make
147 make test
148 make install
149
150 Known problems
151 Configure
152
153 No known problems yet
154
155 Build
156
157 Error message "No error definitions found".
158 This error is generated when it is not possible to find the local
159 definitions for error codes, due to the uncommon structure of the
160 Synology file system.
161
162 This error was fixed in the Perl development git for version 5.19,
163 commit 7a8f1212e5482613c8a5b0402528e3105b26ff24.
164
165 Failing tests
166
167 ext/DynaLoader/t/DynaLoader.t
168 One subtest fails due to the uncommon structure of the Synology
169 file system. The file /lib/glibc.so is missing.
170
171 WARNING: Do not symlink /lib/glibc.so.6 to /lib/glibc.so or some
172 system components will start to fail.
173
174 Smoke testing Perl 5
175 If building completes successfully, you can set up smoke testing as
176 described in the Test::Smoke documentation.
177
178 For smoke testing you need a running Perl. You can either install the
179 Synology supplied package for Perl 5.8.6, or build and install your
180 own, much more recent version.
181
182 Note that I could not run successful smokes when initiated by the
183 Synology Task Scheduler. I resorted to initiating the smokes via a cron
184 job run on another system, using ssh:
185
186 ssh nas1 wrk/Test-Smoke/smoke/smokecurrent.sh
187
188 Local patches
189
190 When local patches are applied with smoke testing, the test driver will
191 automatically request regeneration of certain tables after the patches
192 are applied. The Synology supplied Perl 5.8.6 (at least on the DS413)
193 is NOT capable of generating these tables. It will generate opcodes
194 with bogus values, causing the build to fail.
195
196 You can prevent regeneration by adding the setting
197
198 'flags' => 0,
199
200 to the smoke config, or by adding another patch that inserts
201
202 exit 0 if $] == 5.008006;
203
204 in the beginning of the "regen.pl" program.
205
206 Adding libraries
207 The above procedure describes a basic environment and hence results in
208 a basic Perl. If you want to add additional libraries to Perl, you may
209 need some extra settings.
210
211 For example, the basic Perl does not have any of the DB libraries (db,
212 dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to
213 set environment variable LD_LIBRARY_PATH to the appropriate value:
214
215 LD_LIBRARY_PATH=/lib:/opt/lib
216 export LD_LIBRARY_PATH
217
218 This setting needs to be in effect while Perl is built, but also when
219 the programs are run.
220
222 June 2017, for Synology DSM 5.1.5022 and DSM 6.1-15101-4.
223
225 Johan Vromans <jvromans@squirrel.nl> H. Merijn Brand
226 <h.m.brand@xs4all.nl>
227
228
229
230perl v5.36.0 2022-08-30 PERLSYNOLOGY(1)