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