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.24.0 on DSM-6.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.24.1.
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, wl500g, x86_32, and
107 x86_64. Check here <http://pkg.entware.net/binaries/> for supported
108 platforms.
109
110 Entware-ng comes with a precompiled 5.24.1 (June 2017) that allowes
111 building shared XS code. Note that this installation does not use a
112 site_perl folder. The available "cpan" works. If all required
113 development packages are installed too, also for XS.
114
115 Compiling Perl 5
116 When the build environment has been set up, building and testing Perl
117 is straightforward. The only thing you need to do is download the
118 sources as usual, and add a file Policy.sh as follows:
119
120 # Administrivia.
121 perladmin="your.email@goes.here"
122
123 # Install Perl in a tree in /opt/perl instead of /opt/bin.
124 prefix=/opt/perl
125
126 # Select the compiler. Note that there is no 'cc' alias or link.
127 cc=gcc
128
129 # Build flags.
130 ccflags="-DDEBUGGING"
131
132 # Library and include paths.
133 libpth="/lib"
134 locincpth="/opt/include"
135 loclibpth="/lib"
136
137 You may want to create the destination directory and give it the right
138 permissions before installing, thus eliminating the need to build Perl
139 as a super user.
140
141 In the directory where you unpacked the sources, issue the familiar
142 commands:
143
144 ./Configure -des
145 make
146 make test
147 make install
148
149 Known problems
150 Configure
151
152 No known problems yet
153
154 Build
155
156 Error message "No error definitions found".
157 This error is generated when it is not possible to find the local
158 definitions for error codes, due to the uncommon structure of the
159 Synology file system.
160
161 This error was fixed in the Perl development git for version 5.19,
162 commit 7a8f1212e5482613c8a5b0402528e3105b26ff24.
163
164 Failing tests
165
166 ext/DynaLoader/t/DynaLoader.t
167 One subtest fails due to the uncommon structure of the Synology
168 file system. The file /lib/glibc.so is missing.
169
170 WARNING: Do not symlink /lib/glibc.so.6 to /lib/glibc.so or some
171 system components will start to fail.
172
173 Smoke testing Perl 5
174 If building completes successfully, you can set up smoke testing as
175 described in the Test::Smoke documentation.
176
177 For smoke testing you need a running Perl. You can either install the
178 Synology supplied package for Perl 5.8.6, or build and install your
179 own, much more recent version.
180
181 Note that I could not run successful smokes when initiated by the
182 Synology Task Scheduler. I resorted to initiating the smokes via a cron
183 job run on another system, using ssh:
184
185 ssh nas1 wrk/Test-Smoke/smoke/smokecurrent.sh
186
187 Local patches
188
189 When local patches are applied with smoke testing, the test driver will
190 automatically request regeneration of certain tables after the patches
191 are applied. The Synology supplied Perl 5.8.6 (at least on the DS413)
192 is NOT capable of generating these tables. It will generate opcodes
193 with bogus values, causing the build to fail.
194
195 You can prevent regeneration by adding the setting
196
197 'flags' => 0,
198
199 to the smoke config, or by adding another patch that inserts
200
201 exit 0 if $] == 5.008006;
202
203 in the beginning of the "regen.pl" program.
204
205 Adding libraries
206 The above procedure describes a basic environment and hence results in
207 a basic Perl. If you want to add additional libraries to Perl, you may
208 need some extra settings.
209
210 For example, the basic Perl does not have any of the DB libraries (db,
211 dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to
212 set environment variable LD_LIBRARY_PATH to the appropriate value:
213
214 LD_LIBRARY_PATH=/lib:/opt/lib
215 export LD_LIBRARY_PATH
216
217 This setting needs to be in effect while Perl is built, but also when
218 the programs are run.
219
221 June 2017, for Synology DSM 5.1.5022 and DSM 6.1-15101-4.
222
224 Johan Vromans <jvromans@squirrel.nl> H. Merijn Brand
225 <h.m.brand@xs4all.nl>
226
227
228
229perl v5.28.2 2018-11-01 PERLSYNOLOGY(1)