optimize XSUBs to use targets if the -nooptimize xsubpp option is
[p5sagit/p5-mst-13.2.git] / README.vms
1 Last revised 27-October-1999 by Craig Berry <craig.berry@metamor.com>
2 Revised 01-March-1999 by Dan Sugalski <dan@sidhe.org>
3 Originally by Charles Bailey <bailey@newman.upenn.edu>
4
5 * Important safety tip
6
7 The build and install procedures have changed significantly from the 5.004
8 releases! Make sure you read the "Building Perl" and "Installing Perl"
9 sections before you build or install.
10
11 Also note that, as of 5.005, an ANSI C compliant compiler is required to
12 build Perl. Vax C is *not* ANSI compliant, as it died a natural death some
13 time before the standard was set. Therefore Vax C will not compile perl
14 5.005. Sorry about that.
15
16 If you're stuck without Dec C (the Vax C license should be good for Dec C,
17 but the media charges might prohibit an upgrade), consider getting Gnu C
18 instead.
19
20 * Intro
21
22 The VMS port of Perl is as functionally complete as any other Perl port
23 (and as complete as the ports on some Unix systems). The Perl binaries
24 provide all the Perl system calls that are either available under VMS or
25 reasonably emulated. There are some incompatibilites in process handling
26 (e.g the fork/exec model for creating subprocesses doesn't do what you
27 might expect under Unix), mainly because VMS and Unix handle processes and
28 sub-processes very differently.
29
30 There are still some unimplemented system functions, and of coursse we
31 could use modules implementing useful VMS system services, so if you'd like
32 to lend a hand we'd love to have you. Join the Perl Porting Team Now!
33
34 The current sources and build procedures have been tested on a VAX using
35 Dec C, and on an AXP using Dec C. If you run into problems with
36 other compilers, please let us know.
37
38 There are issues with varions versions of Dec C, so if you're not running a
39 relatively modern version, check the Dec C issues section later on in this
40 document.
41
42 * Other required software
43
44 In addition to VMS, you'll need:
45         1) A C compiler. Dec C or gcc for AXP or the VAX.
46         2) A make tool. Dec's MMS (v2.6 or later), or MadGoat's free MMS
47            analog MMK (available from ftp.madgoat.com/madgoat) both work
48            just fine. Gnu Make might work, but it's been so long since
49            anyone's tested it that we're not sure. MMK's free, though, so
50            go ahead and use that.
51
52 You may also want to have on hand:
53         1) UNZIP.EXE for VMS available from a number of web/ftp sites.
54     http://www.cdrom.com/pub/infozip/UnZip.html
55     http://www.openvms.digital.com/cd/INFO-ZIP/
56     ftp://ftp.digital.com/pub/VMS/
57     ftp://ftp.openvms.digital.com/
58     ftp://ftp.madgoat.com/madgoat/
59     ftp://ftp.wku.edu/vms/
60         2) GUNZIP/GZIP.EXE for VMS available from a number of web/ftp sites.
61     http://www.fsf.org/order/ftp.html
62     ftp://ftp.uu.net/archive/systems/gnu/diffutils*.tar.gz
63     ftp://gatekeeper.dec.com/pub/GNU/diffutils*.tar.gz
64     ftp://ftp.gnu.org/pub/gnu/diffutils*.tar.gz 
65     http://www.openvms.digital.com/cd/GZIP/
66     ftp://ftp.digital.com/pub/VMS/
67         3) VMS TAR also available from a number of web/ftp sites.
68     ftp://ftp.lp.se/vms/
69     http://www.openvms.digital.com/cd/VMSTAR/
70     ftp://ftp.digital.com/pub/VMS/
71 Please note that UNZIP and GUNZIP are not the same thing (they work with
72 different formats).  Most of the useful files from CPAN (the Comprehensive
73 Perl Archive Network) are in .tar.gz format (this includes copies of the
74 source code for perl as well as modules and scripts that you may wish to
75 add later) hence you probably want to have GUNZIP.EXE and VMSTAR.EXE on
76 your VMS machine.
77
78 If you want to include socket support, you'll need a TCP stack and either
79 Dec C, or socket libraries. See the Socket Support topic for more details.
80
81 * Building Perl
82
83 Building perl has two steps, configuration and compilation.
84
85 To configure perl (a necessary first step), issue the command
86
87 @CONFIGURE
88
89 from the top of an unpacked perl directory. You'll be asked a series of
90 questions, and the answers to them (along with the capabilities of your C
91 compiler and network stack) will determine how perl's built.
92
93 If you've got multiple C compilers installed, you'll have your choice of
94 which one to use. Various older versions of Dec C had some gotchas, so if
95 you're using a version older than 5.2, check the Dec C Issues section.
96
97 The configuration script will print out, at the very end, the MMS or MMK
98 command you need to compile perl. Issue it (exactly as printed) to start
99 the build.
100
101 Once you issue your MMS command, sit back and wait. Perl should build and
102 link without a problem. If it doesn't, check the Gotchas to watch out for
103 section. If that doesn't help, send some mail to the VMSPERL mailing list.
104 Instructions are in the Mailing Lists section.
105
106 As a handy shortcut, the command:
107
108 @CONFIGURE "-des"
109
110 (note the quotation marks and case) will choose reasonable defaults. (It 
111 takes Dec C over Gnu C, Dec C sockets over SOCKETSHR sockets, and either 
112 over no sockets)
113
114 * Testing Perl
115
116 Once Perl has built cleanly, you need to test it to make sure things work.
117 This step is very important--there are always things that can go wrong
118 somehow and get you a dysfunctional Perl.
119
120 Testing is very easy, though, as there's a full test suite in the perl
121 distribution. To run the tests, enter the *exact* MMS line you used to
122 compile Perl and add the word "test" to the end, like this:
123
124 Compile Command:
125
126 $MMS
127
128 Test Command:
129
130 $MMS test
131
132 MMS will run all the tests. This may take some time, as there are a lot of
133 tests. If any tests fail, there will be a note made on-screen. At the end
134 of all the tests, a summary of the tests, the number passed and failed, and
135 the time taken will be displayed.
136
137 If any tests fail, it means something's wrong with Perl. If the test suite
138 hangs (some tests can take upwards of two or three minutes, or more if
139 you're on an especially slow machine, depending on your machine speed, so
140 don't be hasty), then the test *after* the last one displayed failed. Don't
141 install Perl unless you're confident that you're OK. Regardless of how
142 confident you are, make a bug report to the VMSPerl mailing list.
143
144 If one or more tests fail, you can get more info on the failure by issuing
145 this command sequence:
146
147 $ @[.VMS]TEST .typ "" "-v" [.subdir]test.T
148
149 where ".typ" is the file type of the Perl images you just built (if you
150 didn't do anything special, use .EXE), and "[.subdir]test.T" is the test
151 that failed. For example, with a normal Perl build, if the test indicated
152 that [.op]time failed, then you'd do this:
153
154 $ @[.VMS]TEST .EXE "" "-v" [.OP]TIME.T
155
156 When you send in a bug report for failed tests, please include the output
157 from this command, which is run from the main source directory:
158
159 MCR []MINIPERL "-V"
160
161 Note that "-V" really is a capital V in double quotes. This will dump out a
162 couple of screens worth of config info, and can help us diagnose the problem.
163 If (and only if) that did not work then try enclosing the output of:
164
165 @[.vms]myconfig
166
167 * Cleaning up and starting fresh
168
169 If you need to recompile from scratch, you have to make sure you clean up
170 first. There's a procedure to do it--enter the *exact* MMS line you used to
171 compile and add "realclean" at the end, like this:
172
173 Compile Command:
174
175 $MMS
176
177 Cleanup Command:
178
179 $MMS realclean
180
181 If you don't do this, things may behave erratically. They might not, too,
182 so it's best to be sure and do it.
183
184 * Installing Perl
185
186 There are several steps you need to take to get Perl installed and
187 running.
188
189 1) Create a directory somewhere and define the concealed logical PERL_ROOT
190 to point to it. For example, DEFINE/TRANS=(CONC,TERM) PERL_ROOT dka200:[perl.]
191
192 2) Run the install script via:
193
194 MMS install
195
196 or
197
198 MMK install
199
200 If for some reason it complains about target INSTALL being up to date,
201 throw a /FORCE switch on the MMS or MMK command.
202
203 The script [.VMS]PERL_SETUP.COM that is written by CONFIGURE.COM 
204 will take care of most of the following:
205
206 3) Either define the symbol PERL somewhere, such as
207 SYS$MANAGER:SYLOGIN.COM, to be "PERL :== $PERL_ROOT:[000000]PERL.EXE", or
208 install Perl into DCLTABLES.EXE (Check out the section "Installing Perl
209 into DCLTABLES" for more info), or put the image in a directory that's in
210 your DCL$PATH (if you're using VMS 6.2 or higher).
211
212 4) Either define the logical name PERLSHR somewhere 
213 (such as in PERL_SETUP.COM) like so:
214 DEFINE/NOLOG PERLSHR PERL_ROOT:[000000]PERLSHR.EXE
215 or copy perl_root:[000000]perlshr.exe sys$share:.
216
217 5) Optionally define the command PERLDOC as 
218 PERLDOC == "$PERL_ROOT:[000000]PERL PERL_ROOT:[LIB.POD]PERLDOC.COM -t"
219 Note that if you wish to use most as a pager please see
220 ftp://space.mit.edu/pub/davis/ for both most and slang (or perhaps
221 ftp://ftp.wku.edu/vms/narnia/most.zip ).
222
223 6) Optionally define the command PERLBUG (the Perl bug report generator) as
224 PERLBUG == "$PERL_ROOT:[000000]PERL PERL_ROOT:[LIB]PERLBUG.COM"
225
226 7) Optionally define the command POD2MAN (Converts POD files to nroff
227 source suitable for converting to man pages. Also quiets complaints during
228 module builds) as
229
230 DEFINE/NOLOG POD2MAN PERL_ROOT:[LIB.POD]POD2MAN.COM
231 POD2MAN == "$PERL_ROOT:[000000]PERL POD2MAN"
232
233 8) Optionally define the command POD2TEXT (Converts POD files to text,
234 which is required for perldoc -f to work properly) as
235
236 DEFINE/NOLOG POD2TEXT PERL_ROOT:[LIB.POD]POD2TEXT.COM
237 POD2TEXT == "$PERL_ROOT:[000000]PERL POD2TEXT"
238
239 In all these cases, if you've got PERL defined as a foreign command, you
240 can replace $PERL_ROOT:[000000]PERL with ''perl'. If you've installed perl
241 into DCLTABLES, replace it with just perl.
242
243 * Installing Perl into DCLTABLES
244
245 Execute the following command file to define PERL as a DCL command.
246 You'll need CMKRNL priv to install the new dcltables.exe.
247
248 $ create perl.cld
249 !
250 ! modify to reflect location of your perl.exe
251 !
252 define verb perl
253   image perl_root:[000000]perl.exe
254   cliflags (foreign)
255 $!
256 $ set command perl /table=sys$common:[syslib]dcltables.exe -
257  /output=sys$common:[syslib]dcltables.exe
258 $ install replace sys$common:[syslib]dcltables.exe
259 $ exit
260
261 * Changing compile-time things
262
263 Most of the user-definable features of Perl are enabled or disabled in
264 [.VMS]CONFIG.VMS. There's code in there to Do The Right Thing, but that may
265 end up being the wrong thing for you. Make sure you understand what you're
266 doing, since changes here can get you a busted perl.
267
268 Odds are that there's nothing here to change, unless you're on a version of
269 VMS later than 6.2 and Dec C later than 5.6. Even if you are, the correct
270 values will still be chosen, most likely. Poking around here should be
271 unnecessary.
272
273 The one exception is the various *DIR install locations. Changing those
274 requires changes in genconfig.pl as well. Be really careful if you need to
275 change these, as they can cause some fairly subtle problems.
276
277 * INSTALLing images
278
279 On systems that are using perl quite a bit, and particularly those with 
280 minimal RAM, you can boost the performance of perl by INSTALLing it as
281 a known image.  PERLSHR.EXE is typically larger than 2000 blocks
282 and that is a reasonably large amount of IO to load each time perl is 
283 invoked. 
284
285    INSTALL ADD PERLSHR/SHARE
286
287 should be enough for PERLSHR.EXE (/share implies /header and /open), 
288 while /HEADER should do for PERL.EXE (perl.exe is not a shared image).
289
290 If your code 'use's modules, check to see if there's an executable for
291 them, too. In the base perl build, POSIX, IO, Fcntl, Opcode, SDBM_File,
292 DCLsym, and Stdio all have shared images that can be installed /SHARE.
293
294 How much of a win depends on your memory situation, but if you're firing
295 off perl with any regularity (like more than once every 20 seconds or so)
296 it's probably a win.
297
298 While there is code in perl to remove privileges as it runs you are advised
299 to NOT INSTALL PERL.EXE with PRIVs!
300
301 * Extra things in the Perl distribution
302
303 In addition to the standard stuff that gets installed, there are two
304 optional extensions, DCLSYM and STDIO, that are handy. Instructions for
305 these two modules are in [.VMS.EXT.DCLSYM] and [.VMS.EXT.STDIO],
306 respectively.  They are built automatically for versions of perl >= 5.005.
307
308 * Socket Support
309
310 Perl includes a number of functions for IP sockets, which are available if
311 you choose to compile Perl with socket support (see the section Compiling
312 Perl for more info on selecting a socket stack).  Since IP networking is an
313 optional addition to VMS, there are several different IP stacks
314 available. How well integrated they are into the system depends on the
315 stack, your version of VMS, and the version of your C compiler.
316
317 The most portable solution uses the SOCKETSHR library. In combination with
318 either UCX or NetLib, this supports all the major TCP stacks (Multinet,
319 Pathways, TCPWare, UCX, and CMU) on all versions of VMS Perl runs on, with
320 all the compilers on both VAX and Alpha. The socket interface is also
321 consistent across versions of VMS and C compilers. It has a problem with
322 UDP sockets when used with Multinet, though, so you should be aware of
323 that.
324
325 The other solution available is to use the socket routines built into Dec
326 C. Which routines are available depend on the version of VMS you're
327 running, and require proper UCX emulation by your TCP/IP vendor.
328 Relatively current versions of Multinet, TCPWare, Pathway, and UCX all
329 provide the required libraries--check your manuals or release notes to see
330 if your version is new enough.
331
332 * Reporting Bugs
333
334 If you come across what you think might be a bug in Perl, please report
335 it. There's a script in PERL_ROOT:[UTILS], perlbug, that walks you through
336 the process of creating a bug report. This script includes details of your
337 installation, and is very handy. Completed bug reports should go to
338 perlbug@perl.com.
339
340 * Gotchas to watch out for
341
342 Probably the single biggest gotcha in compiling Perl is giving the wrong
343 switches to MMS/MMK when you build. Use *exactly* what the configure script
344 prints!
345
346 The next big gotcha is directory depth. Perl can create directories four
347 and five levels deep during the build, so you don't have to be too deep to
348 start to hit the RMS 8 level point. It's best to do a
349 $DEFINE/TRANS=(CONC,TERM) PERLSRC disk:[dir.dir.dir.perldir.]"  (note the
350 trailing period) and $SET DEFAULT PERLSRC:[000000] before building. Perl
351 modules can be just as bad (or worse), so watch out for them, too. The
352 configuration script will warn if it thinks you're too deep (at least on 
353 versions of VMS prior to 7.2).
354
355 Finally, the third thing that bites people is leftover pieces from a failed
356 build. If things go wrong, make sure you do a "(MMK|MMS|make) realclean"
357 before you rebuild.
358
359 * Dec C issues
360
361 Note to DECC users: Some early versions (pre-5.2, some pre-4. If you're Dec
362 C 5.x or higher, with current patches if any, you're fine) of the DECCRTL
363 contained a few bugs which affect Perl performance:
364     - Newlines are lost on I/O through pipes, causing lines to run together.
365       This shows up as RMS RTB errors when reading from a pipe.  You can
366       work around this by having one process write data to a file, and
367       then having the other read the file, instead of the pipe.  This is
368       fixed in version 4 of DECC.
369     - The modf() routine returns a non-integral value for some values above
370       INT_MAX; the Perl "int" operator will return a non-integral value in
371       these cases.  This is fixed in version 4 of DECC.
372     - On the AXP, if SYSNAM privilege is enabled, the CRTL chdir() routine
373       changes the process default device and directory permanently, even
374       though the call specified that the change should not persist after
375       Perl exited.  This is fixed by DEC CSC patch AXPACRT04_061.
376
377 * Mailing Lists
378
379 There are several mailing lists available to the Perl porter. For VMS
380 specific issues (including both Perl questions and installation problems)
381 there is the VMSPERL mailing list. It's usually a low-volume (10-12
382 messages a week) mailing list.
383
384 The subscription address is MAJORDOMO@PERL.ORG. Send a mail message with just
385 the words SUBSCRIBE VMSPERL in the body of the message.
386    
387 The VMSPERL mailing list address is VMSPERL@PERL.ORG.  Any mail sent there
388 gets echoed to all subscribers of the list.  There is a searchable archive of
389 the list at <http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/>.
390    
391 To unsubscribe from VMSPERL send the message UNSUBSCRIBE VMSPERL to
392 MAJORDOMO@PERL.ORG.  Be sure to do so from the subscribed account that 
393 you are cancelling.
394
395 * Acknowledgements
396
397 A real big thanks needs to go to Charles Bailey
398 <bailey@newman.upenn.edu>, who is ultimately responsible for Perl 5.004
399 running on VMS. Without him, nothing the rest of us have done would be at
400 all important.
401
402 There are, of course, far too many people involved in the porting and testing
403 of Perl to mention everyone who deserves it, so please forgive us if we've
404 missed someone.  That said, special thanks are due to the following:
405   Tim Adye <T.J.Adye@rl.ac.uk>
406      for the VMS emulations of getpw*()
407   David Denholm <denholm@conmat.phys.soton.ac.uk>
408      for extensive testing and provision of pipe and SocketShr code,
409   Mark Pizzolato <mark@infocomm.com>
410      for the getredirection() code
411   Rich Salz <rsalz@bbn.com>
412      for readdir() and related routines
413   Peter Prymmer <pvhp@forte.com> or <pvhp@lns62.lns.cornell.edu>
414      for extensive testing, as well as development work on
415      configuration and documentation for VMS Perl,
416   Dan Sugalski <dan@sidhe.org>
417      for extensive contributions to recent version support,
418      development of VMS-specific extensions, and dissemination
419      of information about VMS Perl,
420   the Stanford Synchrotron Radiation Laboratory and the
421      Laboratory of Nuclear Studies at Cornell University for
422      the opportunity to test and develop for the AXP,
423 and to the entire VMSperl group for useful advice and suggestions.  In
424 addition the perl5-porters deserve credit for their creativity and
425 willingness to work with the VMS newcomers.  Finally, the greatest debt of
426 gratitude is due to Larry Wall <larry@wall.org>, for having the ideas which
427 have made our sleepless nights possible.
428
429 Thanks,
430 The VMSperl group