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