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