1PERLOS390(1) Perl Programmers Reference Guide PERLOS390(1)
2
3
4
6 perlos390 - building and installing Perl for OS/390 and z/OS
7
9 This document will help you Configure, build, test and install Perl on
10 OS/390 (aka z/OS) Unix System Services.
11
12 This document needs to be updated, but we don't know what it should
13 say. Please email comments to perlbug@perl.org
14 <mailto:perlbug@perl.org>.
15
17 This is a fully ported Perl for OS/390 Version 2 Release 3, 5, 6, 7, 8,
18 and 9. It may work on other versions or releases, but those are the
19 ones we've tested it on.
20
21 You may need to carry out some system configuration tasks before
22 running the Configure script for Perl.
23
24 Tools
25 The z/OS Unix Tools and Toys list may prove helpful and contains links
26 to ports of much of the software helpful for building Perl.
27 <http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html>
28
29 Unpacking Perl distribution on OS/390
30 If using ftp remember to transfer the distribution in binary format.
31
32 Gunzip/gzip for OS/390 is discussed at:
33
34 http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty1.html
35
36 to extract an ASCII tar archive on OS/390, try this:
37
38 pax -o to=IBM-1047,from=ISO8859-1 -r < latest.tar
39
40 or
41
42 zcat latest.tar.Z | pax -o to=IBM-1047,from=ISO8859-1 -r
43
44 If you get lots of errors of the form
45
46 tar: FSUM7171 ...: cannot set uid/gid: EDC5139I Operation not permitted
47
48 you didn't read the above and tried to use tar instead of pax, you'll
49 first have to remove the (now corrupt) perl directory
50
51 rm -rf perl-...
52
53 and then use pax.
54
55 Setup and utilities for Perl on OS/390
56 Be sure that your yacc installation is in place including any necessary
57 parser template files. If you have not already done so then be sure to:
58
59 cp /samples/yyparse.c /etc
60
61 This may also be a good time to ensure that your /etc/protocol file and
62 either your /etc/resolv.conf or /etc/hosts files are in place. The IBM
63 document that described such USS system setup issues was SC28-1890-07
64 "OS/390 UNIX System Services Planning", in particular Chapter 6 on
65 customizing the OE shell.
66
67 GNU make for OS/390, which is recommended for the build of perl (as
68 well as building CPAN modules and extensions), is available from the
69 "Tools".
70
71 Some people have reported encountering "Out of memory!" errors while
72 trying to build Perl using GNU make binaries. If you encounter such
73 trouble then try to download the source code kit and build GNU make
74 from source to eliminate any such trouble. You might also find GNU
75 make (as well as Perl and Apache) in the red-piece/book "Open Source
76 Software for OS/390 UNIX", SG24-5944-00 from IBM.
77
78 If instead of the recommended GNU make you would like to use the system
79 supplied make program then be sure to install the default rules file
80 properly via the shell command:
81
82 cp /samples/startup.mk /etc
83
84 and be sure to also set the environment variable _C89_CCMODE=1
85 (exporting _C89_CCMODE=1 is also a good idea for users of GNU make).
86
87 You might also want to have GNU groff for OS/390 installed before
88 running the "make install" step for Perl.
89
90 There is a syntax error in the /usr/include/sys/socket.h header file
91 that IBM supplies with USS V2R7, V2R8, and possibly V2R9. The problem
92 with the header file is that near the definition of the SO_REUSEPORT
93 constant there is a spurious extra '/' character outside of a comment
94 like so:
95
96 #define SO_REUSEPORT 0x0200 /* allow local address & port
97 reuse */ /
98
99 You could edit that header yourself to remove that last '/', or you
100 might note that Language Environment (LE) APAR PQ39997 describes the
101 problem and PTF's UQ46272 and UQ46271 are the (R8 at least) fixes and
102 apply them. If left unattended that syntax error will turn up as an
103 inability for Perl to build its "Socket" extension.
104
105 For successful testing you may need to turn on the sticky bit for your
106 world readable /tmp directory if you have not already done so (see man
107 chmod).
108
109 Configure Perl on OS/390
110 Once you've unpacked the distribution, run "sh Configure" (see INSTALL
111 for a full discussion of the Configure options). There is a "hints"
112 file for os390 that specifies the correct values for most things. Some
113 things to watch out for include:
114
115 · A message of the form:
116
117 (I see you are using the Korn shell. Some ksh's blow up on
118 Configure, mainly on older exotic systems. If yours does, try the
119 Bourne shell instead.)
120
121 is nothing to worry about at all.
122
123 · Some of the parser default template files in /samples are needed in
124 /etc. In particular be sure that you at least copy
125 /samples/yyparse.c to /etc before running Perl's Configure. This
126 step ensures successful extraction of EBCDIC versions of parser
127 files such as perly.c and perly.h. This has to be done before
128 running Configure the first time. If you failed to do so then the
129 easiest way to re-Configure Perl is to delete your misconfigured
130 build root and re-extract the source from the tar ball. Then you
131 must ensure that /etc/yyparse.c is properly in place before
132 attempting to re-run Configure.
133
134 · This port will support dynamic loading, but it is not selected by
135 default. If you would like to experiment with dynamic loading then
136 be sure to specify -Dusedl in the arguments to the Configure
137 script. See the comments in hints/os390.sh for more information on
138 dynamic loading. If you build with dynamic loading then you will
139 need to add the $archlibexp/CORE directory to your LIBPATH
140 environment variable in order for perl to work. See the config.sh
141 file for the value of $archlibexp. If in trying to use Perl you
142 see an error message similar to:
143
144 CEE3501S The module libperl.dll was not found.
145 From entry point __dllstaticinit at compile unit offset +00000194
146 at
147
148 then your LIBPATH does not have the location of libperl.x and
149 either libperl.dll or libperl.so in it. Add that directory to your
150 LIBPATH and proceed.
151
152 · Do not turn on the compiler optimization flag "-O". There is a bug
153 in either the optimizer or perl that causes perl to not work
154 correctly when the optimizer is on.
155
156 · Some of the configuration files in /etc used by the networking APIs
157 are either missing or have the wrong names. In particular, make
158 sure that there's either an /etc/resolv.conf or an /etc/hosts, so
159 that gethostbyname() works, and make sure that the file /etc/proto
160 has been renamed to /etc/protocol (NOT /etc/protocols, as used by
161 other Unix systems). You may have to look for things like HOSTNAME
162 and DOMAINORIGIN in the "//'SYS1.TCPPARMS(TCPDATA)'" PDS member in
163 order to properly set up your /etc networking files.
164
165 Build, Test, Install Perl on OS/390
166 Simply put:
167
168 sh Configure
169 make
170 make test
171
172 if everything looks ok (see the next section for test/IVP diagnosis)
173 then:
174
175 make install
176
177 this last step may or may not require UID=0 privileges depending on how
178 you answered the questions that Configure asked and whether or not you
179 have write access to the directories you specified.
180
181 Build Anomalies with Perl on OS/390
182 "Out of memory!" messages during the build of Perl are most often fixed
183 by re building the GNU make utility for OS/390 from a source code kit.
184
185 Another memory limiting item to check is your MAXASSIZE parameter in
186 your 'SYS1.PARMLIB(BPXPRMxx)' data set (note too that as of V2R8
187 address space limits can be set on a per user ID basis in the USS
188 segment of a RACF profile). People have reported successful builds of
189 Perl with MAXASSIZE parameters as small as 503316480 (and it may be
190 possible to build Perl with a MAXASSIZE smaller than that).
191
192 Within USS your /etc/profile or $HOME/.profile may limit your ulimit
193 settings. Check that the following command returns reasonable values:
194
195 ulimit -a
196
197 To conserve memory you should have your compiler modules loaded into
198 the Link Pack Area (LPA/ELPA) rather than in a link list or step lib.
199
200 If the c89 compiler complains of syntax errors during the build of the
201 Socket extension then be sure to fix the syntax error in the system
202 header /usr/include/sys/socket.h.
203
204 Testing Anomalies with Perl on OS/390
205 The "make test" step runs a Perl Verification Procedure, usually before
206 installation. You might encounter STDERR messages even during a
207 successful run of "make test". Here is a guide to some of the more
208 commonly seen anomalies:
209
210 · A message of the form:
211
212 io/openpid...........CEE5210S The signal SIGHUP was received.
213 CEE5210S The signal SIGHUP was received.
214 CEE5210S The signal SIGHUP was received.
215 ok
216
217 indicates that the t/io/openpid.t test of Perl has passed but done
218 so with extraneous messages on stderr from CEE.
219
220 · A message of the form:
221
222 lib/ftmp-security....File::Temp::_gettemp: Parent directory (/tmp/)
223 is not safe (sticky bit not set when world writable?) at
224 lib/ftmp-security.t line 100
225 File::Temp::_gettemp: Parent directory (/tmp/) is not safe (sticky
226 bit not set when world writable?) at lib/ftmp-security.t line 100
227 ok
228
229 indicates a problem with the permissions on your /tmp directory
230 within the HFS. To correct that problem issue the command:
231
232 chmod a+t /tmp
233
234 from an account with write access to the directory entry for /tmp.
235
236 · Out of Memory!
237
238 Recent perl test suite is quite memory hungry. In addition to the
239 comments above on memory limitations it is also worth checking for
240 _CEE_RUNOPTS in your environment. Perl now has (in miniperlmain.c)
241 a C #pragma to set CEE run options, but the environment variable
242 wins.
243
244 The C code asks for:
245
246 #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
247
248 The important parts of that are the second argument (the increment)
249 to HEAP, and allowing the stack to be "Above the (16M) line". If
250 the heap increment is too small then when perl (for example loading
251 unicode/Name.pl) tries to create a "big" (400K+) string it cannot
252 fit in a single segment and you get "Out of Memory!" - even if
253 there is still plenty of memory available.
254
255 A related issue is use with perl's malloc. Perl's malloc uses
256 "sbrk()" to get memory, and "sbrk()" is limited to the first
257 allocation so in this case something like:
258
259 HEAP(8M,500K,ANYWHERE,KEEP,8K,4K)
260
261 is needed to get through the test suite.
262
263 Installation Anomalies with Perl on OS/390
264 The installman script will try to run on OS/390. There will be fewer
265 errors if you have a roff utility installed. You can obtain GNU groff
266 from the Redbook SG24-5944-00 ftp site.
267
268 Usage Hints for Perl on OS/390
269 When using perl on OS/390 please keep in mind that the EBCDIC and ASCII
270 character sets are different. See perlebcdic.pod for more on such
271 character set issues. Perl builtin functions that may behave
272 differently under EBCDIC are also mentioned in the perlport.pod
273 document.
274
275 Open Edition (UNIX System Services) from V2R8 onward does support
276 #!/path/to/perl script invocation. There is a PTF available from IBM
277 for V2R7 that will allow shell/kernel support for #!. USS releases
278 prior to V2R7 did not support the #! means of script invocation. If
279 you are running V2R6 or earlier then see:
280
281 head `whence perldoc`
282
283 for an example of how to use the "eval exec" trick to ask the shell to
284 have Perl run your scripts on those older releases of Unix System
285 Services.
286
287 If you are having trouble with square brackets then consider switching
288 your rlogin or telnet client. Try to avoid older 3270 emulators and
289 ISHELL for working with Perl on USS.
290
291 Floating Point Anomalies with Perl on OS/390
292 There appears to be a bug in the floating point implementation on S/390
293 systems such that calling int() on the product of a number and a small
294 magnitude number is not the same as calling int() on the quotient of
295 that number and a large magnitude number. For example, in the
296 following Perl code:
297
298 my $x = 100000.0;
299 my $y = int($x * 1e-5) * 1e5; # '0'
300 my $z = int($x / 1e+5) * 1e5; # '100000'
301 print "\$y is $y and \$z is $z\n"; # $y is 0 and $z is 100000
302
303 Although one would expect the quantities $y and $z to be the same and
304 equal to 100000 they will differ and instead will be 0 and 100000
305 respectively.
306
307 The problem can be further examined in a roughly equivalent C program:
308
309 #include <stdio.h>
310 #include <math.h>
311 main()
312 {
313 double r1,r2;
314 double x = 100000.0;
315 double y = 0.0;
316 double z = 0.0;
317 x = 100000.0 * 1e-5;
318 r1 = modf (x,&y);
319 x = 100000.0 / 1e+5;
320 r2 = modf (x,&z);
321 printf("y is %e and z is %e\n",y*1e5,z*1e5);
322 /* y is 0.000000e+00 and z is 1.000000e+05 (with c89) */
323 }
324
325 Modules and Extensions for Perl on OS/390
326 Pure pure (that is non xs) modules may be installed via the usual:
327
328 perl Makefile.PL
329 make
330 make test
331 make install
332
333 If you built perl with dynamic loading capability then that would also
334 be the way to build xs based extensions. However, if you built perl
335 with the default static linking you can still build xs based extensions
336 for OS/390 but you will need to follow the instructions in
337 ExtUtils::MakeMaker for building statically linked perl binaries. In
338 the simplest configurations building a static perl + xs extension boils
339 down to:
340
341 perl Makefile.PL
342 make
343 make perl
344 make test
345 make install
346 make -f Makefile.aperl inst_perl MAP_TARGET=perl
347
348 In most cases people have reported better results with GNU make rather
349 than the system's /bin/make program, whether for plain modules or for
350 xs based extensions.
351
352 If the make process encounters trouble with either compilation or
353 linking then try setting the _C89_CCMODE to 1. Assuming sh is your
354 login shell then run:
355
356 export _C89_CCMODE=1
357
358 If tcsh is your login shell then use the setenv command.
359
361 David Fiander and Peter Prymmer with thanks to Dennis Longnecker and
362 William Raffloer for valuable reports, LPAR and PTF feedback. Thanks
363 to Mike MacIsaac and Egon Terwedow for SG24-5944-00. Thanks to Ignasi
364 Roca for pointing out the floating point problems. Thanks to John
365 Goodyear for dynamic loading help.
366
368 INSTALL, perlport, perlebcdic, ExtUtils::MakeMaker.
369
370 http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html
371
372 http://www.redbooks.ibm.com/redbooks/SG245944.html
373
374 http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty1.html#opensrc
375
376 http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
377
378 http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/ceea3030/
379
380 http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/CBCUG030/
381
382 Mailing list for Perl on OS/390
383 If you are interested in the z/OS (formerly known as OS/390) and POSIX-
384 BC (BS2000) ports of Perl then see the perl-mvs mailing list. To
385 subscribe, send an empty message to perl-mvs-subscribe@perl.org.
386
387 See also:
388
389 http://lists.perl.org/list/perl-mvs.html
390
391 There are web archives of the mailing list at:
392
393 http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
394 http://archive.develooper.com/perl-mvs@perl.org/
395
397 This document was originally written by David Fiander for the 5.005
398 release of Perl.
399
400 This document was podified for the 5.005_03 release of Perl 11 March
401 1999.
402
403 Updated 28 November 2001 for broken URLs.
404
405 Updated 12 November 2000 for the 5.7.1 release of Perl.
406
407 Updated 15 January 2001 for the 5.7.1 release of Perl.
408
409 Updated 24 January 2001 to mention dynamic loading.
410
411 Updated 12 March 2001 to mention //'SYS1.TCPPARMS(TCPDATA)'.
412
413
414
415perl v5.30.1 2019-11-29 PERLOS390(1)