This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #29765] PERL-5.8.4 INSTALL
[perl5.git] / INSTALL
CommitLineData
f1300be0
YST
1If you read this file _as_is_, just ignore the funny characters you see.
2It is written in the POD format (see pod/perlpod.pod) which is specially
3designed to be readable as is.
4
8e07c86e
AD
5=head1 NAME
6
7Install - Build and Installation guide for perl5.
8
40dd8381
NC
9=head1 Reporting Problems
10
11Wherever possible please use the perlbug tool supplied with this Perl
12to report problems, as it automatically includes summary configuration
13information about your perl, which may help us track down problems far
14more quickly. But first you should read the advice in this file,
15carefully re-read the error message and check the relevant manual pages
16on your system, as these may help you find an immediate solution. If
17you are not sure whether what you are seeing is a bug, you can send a
18message describing the problem to the comp.lang.perl.misc newsgroup to
19get advice.
20
21The perlbug tool is installed along with perl, so after you have
22completed C<make install> it should be possible to run it with plain
23C<perlbug>. If the install fails, or you want to report problems with
24C<make test> without installing perl, then you can use C<make nok> to
25run perlbug to report the problem, or run it by hand from this source
26directory with C<./perl -Ilib utils/perlbug>
27
28If the build fails too early to run perlbug uninstalled, then please
29B<run> the C<./myconfig> shell script, and mail its output along with
30an accurate description of your problem to perlbug@perl.org
31
32If C<Configure> itself fails, and does not generate a C<config.sh> file
33(needed to run C<./myconfig>), then please mail perlbug@perl.org the
34description of how C<Configure> fails along with details of your system
35- for example the output from running C<uname -a>
36
37Please try to make your message brief but clear. Brief, clear bug
38reports tend to get answered more quickly. Please don't worry if your
39written English is not great - what matters is how well you describe
40the important technical details of the problem you have encountered,
41not whether your grammar and spelling is flawless.
42
43You should trim out unnecessary information. Do not include large
44files (such as config.sh or a complete Configure or make log) unless
45absolutely necessary. Do not include a complete transcript of your
46build session. Just include the failing commands, the relevant error
47messages, and whatever preceding commands are necessary to give the
48appropriate context. Plain text should usually be sufficient--fancy
49attachments or encodings may actually reduce the number of people who
50read your message. Your message will get relayed to over 400
51subscribers around the world so please try to keep it brief but clear.
52
53If you are unsure what makes a good bug report please read "How to
54report Bugs Effectively" by Simon Tatham:
55http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
56
8e07c86e
AD
57=head1 SYNOPSIS
58
3ce0d271
GS
59First, make sure you are installing an up-to-date version of Perl. If
60you didn't get your Perl source from CPAN, check the latest version at
40dd8381 61http://www.cpan.org/src/
3ce0d271 62
c42e3e15
GS
63The basic steps to build and install perl5 on a Unix system
64with all the defaults are:
8e07c86e 65
dc45a647 66 rm -f config.sh Policy.sh
491517e0 67 sh Configure -de
8e07c86e
AD
68 make
69 make test
70 make install
36477c24 71
aa689395
PP
72 # You may also wish to add these:
73 (cd /usr/include && h2ph *.h sys/*.h)
3e3baf6d 74 (installhtml --help)
aa689395 75 (cd pod && make tex && <process the latex files>)
8e07c86e
AD
76
77Each of these is explained in further detail below.
78
cc65bb49 79B<NOTE>: starting from the release 5.6.0, Perl uses a version
fe23a901 80scheme where even-numbered subreleases (like 5.6 and 5.8) are stable
9a664500 81maintenance releases and odd-numbered subreleases (like 5.7 and 5.9) are
b88cc0eb
JH
82unstable development releases. Development releases should not be
83used in production environments. Fixes and new features are first
84carefully tested in development releases and only if they prove
85themselves to be worthy will they be migrated to the maintenance
86releases.
87
cc65bb49
AD
88The above commands will install Perl to /usr/local (or some other
89platform-specific directory -- see the appropriate file in hints/.)
90If that's not okay with you, use
491517e0
JA
91
92 rm -f config.sh Policy.sh
93 sh Configure
94 make
95 make test
96 make install
97
adbebc0b
JH
98For information on non-Unix systems, see the section on L<"Porting
99information"> below.
100
101If "make install" just says "`install' is up to date" or something
cc65bb49
AD
102similar, you may be on a case-insensitive filesystems such as Mac's HFS+,
103and you should say "make install-all". (This confusion is brought to you
adbebc0b 104by the Perl distribution having a file called INSTALL.)
7f678428 105
8d74ce1c 106If you have problems, corrections, or questions, please see
40dd8381 107L<"Reporting Problems"> above.
8d74ce1c 108
7beaa944
AD
109For information on what's new in this release, see the
110pod/perldelta.pod file. For more detailed information about specific
111changes, see the Changes file.
c3edaffb 112
1ec51d55 113=head1 DESCRIPTION
edb1cbcb 114
c3edaffb
PP
115This document is written in pod format as an easy way to indicate its
116structure. The pod format is described in pod/perlpod.pod, but you can
1ec51d55
CS
117read it as is with any pager or editor. Headings and items are marked
118by lines beginning with '='. The other mark-up used is
119
120 B<text> embolden text, used for switches, programs or commands
121 C<code> literal code
122 L<name> A link (cross reference) to name
123
c42e3e15
GS
124Although most of the defaults are probably fine for most users,
125you should probably at least skim through this entire document before
1ec51d55 126proceeding.
c3edaffb 127
eed2e782
PP
128If you're building Perl on a non-Unix system, you should also read
129the README file specific to your operating system, since this may
c35d5681
PN
130provide additional or different instructions for building Perl. There
131are also README files for several flavors of Unix systems, such as
132Solaris, HP-UX, and AIX; if you have one of those systems, you should
133also read the README file specific to that system.
eed2e782 134
203c3eec
AD
135If there is a hint file for your system (in the hints/ directory) you
136should also read that hint file for specific information for your
2ab493b8 137system. (Unixware users should use the svr4.sh or the svr5.sh hint file.)
cc65bb49 138Additional information is in the Porting/ directory.
203c3eec 139
c42e3e15
GS
140=head1 WARNING: This version requires an extra step to build old extensions.
141
1425.005_53 and later releases do not export unadorned
64fa5b0b
DM
143global symbols anymore. This means you may need to build rather old
144extensions that have not been updated for the current naming convention
c42e3e15
GS
145with:
146
147 perl Makefile.PL POLLUTE=1
d56c5707 148
c42e3e15
GS
149Alternatively, you can enable CPP symbol pollution wholesale by
150building perl itself with:
151
152 sh Configure -Accflags=-DPERL_POLLUTE
153
5cda700b 154pod/perl56delta.pod contains more details about this.
c42e3e15 155
64fa5b0b 156=head1 WARNING: This version is not binary compatible with releases of
9a664500 157Perl prior to 5.9.0.
1b1c1ae2 158
cc65bb49 159If you have built extensions (i.e. modules that include C code)
64fa5b0b
DM
160using an earlier version of Perl, you will need to rebuild and reinstall
161those extensions.
1b1c1ae2
GS
162
163Pure perl modules without XS or C code should continue to work fine
164without reinstallation. See the discussions below on
165L<"Coexistence with earlier versions of perl5"> and
fe23a901 166L<"Upgrading from 5.005 or 5.6 to 5.8.0"> for more details.
693762b4
AD
167
168The standard extensions supplied with Perl will be handled automatically.
169
1b1c1ae2 170On a related issue, old modules may possibly be affected by the
693762b4 171changes in the Perl language in the current release. Please see
5cda700b 172pod/perldelta.pod (and the earlier pod/perl5Xdelta.pod) for a description of
c42e3e15 173what's changed. See your installed copy of the perllocal.pod
d6baa268
JH
174file for a (possibly incomplete) list of locally installed modules.
175Also see CPAN::autobundle for one way to make a "bundle" of your
176currently installed modules.
693762b4 177
5effff0b
GS
178=head1 WARNING: This version requires a compiler that supports ANSI C.
179
16dc217a
GS
180Most C compilers are now ANSI-compliant. However, a few current
181computers are delivered with an older C compiler expressly for
182rebuilding the system kernel, or for some other historical reason.
183Alternatively, you may have an old machine which was shipped before
184ANSI compliance became widespread. Such compilers are not suitable
185for building Perl.
186
187If you find that your default C compiler is not ANSI-capable, but you
188know that an ANSI-capable compiler is installed on your system, you
189can tell F<Configure> to use the correct compiler by means of the
190C<-Dcc=> command-line option -- see L<"gcc">.
191
cc65bb49
AD
192If do not have an ANSI-capable compiler there are a couple of avenues
193open to you:
16dc217a
GS
194
195=over 4
196
197=item *
198
199You may try obtaining GCC, available from GNU mirrors worldwide,
40dd8381 200listed at http://www.gnu.org/order/ftp.html . If, rather than
16dc217a
GS
201building gcc from source code, you locate a binary version configured
202for your platform, be sure that it is compiled for the version of the
203operating system that you are using.
204
205=item *
206
207You may purchase a commercial ANSI C compiler from your system
208supplier or elsewhere. (Or your organization may already have
209licensed such software -- ask your colleagues to find out how to
210access it.) If there is a README file for your system in the Perl
211distribution (for example, F<README.hpux>), it may contain advice on
212suitable compilers.
213
16dc217a
GS
214=back
215
df41b452
GS
216Although Perl can be compiled using a C++ compiler, the Configure script
217does not work with some C++ compilers.
218
aa689395 219=head1 Space Requirements
eed2e782 220
9a664500 221The complete perl5 source tree takes up about 60 MB of disk space.
8756f06c 222After completing make, it takes up roughly 100 MB, though the actual
d6baa268 223total is likely to be quite system-dependent. The installation
8756f06c 224directories need something on the order of 45 MB, though again that
9a664500
AMS
225value is system-dependent. A perl build with debug symbols and
226-DDEBUGGING will require something on the order of 10 MB extra.
8e07c86e 227
aa689395 228=head1 Start with a Fresh Distribution
8e07c86e 229
edb1cbcb
PP
230If you have built perl before, you should clean out the build directory
231with the command
232
dc45a647
MB
233 make distclean
234
235or
236
edb1cbcb 237 make realclean
c3edaffb 238
dc45a647
MB
239The only difference between the two is that make distclean also removes
240your old config.sh and Policy.sh files.
241
242The results of a Configure run are stored in the config.sh and Policy.sh
243files. If you are upgrading from a previous version of perl, or if you
244change systems or compilers or make other significant changes, or if
245you are experiencing difficulties building perl, you should probably
d6baa268 246not re-use your old config.sh. Simply remove it
8e07c86e 247
d6baa268 248 rm -f config.sh
4633a7c4 249
e57fd563
PP
250If you wish to use your old config.sh, be especially attentive to the
251version and architecture-specific questions and answers. For example,
252the default directory for architecture-dependent library modules
253includes the version name. By default, Configure will reuse your old
254name (e.g. /opt/perl/lib/i86pc-solaris/5.003) even if you're running
255Configure for a different version, e.g. 5.004. Yes, Configure should
5cda700b 256probably check and correct for this, but it doesn't.
e57fd563
PP
257Similarly, if you used a shared libperl.so (see below) with version
258numbers, you will probably want to adjust them as well.
259
d6baa268
JH
260Also, be careful to check your architecture name. For example, some
261Linux distributions use i386, while others may use i486. If you build
262it yourself, Configure uses the output of the arch command, which
263might be i586 or i686 instead. If you pick up a precompiled binary, or
264compile extensions on different systems, they might not all agree on
265the architecture name.
e57fd563
PP
266
267In short, if you wish to use your old config.sh, I recommend running
268Configure interactively rather than blindly accepting the defaults.
8e07c86e 269
d6baa268
JH
270If your reason to reuse your old config.sh is to save your particular
271installation choices, then you can probably achieve the same effect by
272using the Policy.sh file. See the section on L<"Site-wide Policy
273settings"> below. If you wish to start with a fresh distribution, you
274also need to remove any old Policy.sh files you may have with
275
276 rm -f Policy.sh
dc45a647 277
aa689395 278=head1 Run Configure
8e07c86e
AD
279
280Configure will figure out various things about your system. Some
281things Configure will figure out for itself, other things it will ask
d6baa268
JH
282you about. To accept the default, just press RETURN. The default is
283almost always okay. It is normal for some things to be "NOT found",
284since Configure often searches for many different ways of performing
285the same function.
286
287At any Configure prompt, you can type &-d and Configure will use the
288defaults from then on.
8e07c86e
AD
289
290After it runs, Configure will perform variable substitution on all the
1ec51d55 291*.SH files and offer to run make depend.
8e07c86e 292
3f847123
MB
293=head2 Disabling older versions of Perl
294
295Configure will search for binary compatible versions of previously
296installed perl binaries in the tree that is specified as target tree
297and these will be used by the perl being built.
298
299To disable use of older perl modules, even completely valid pure perl
300modules, you can specify to not include the pathes found:
301
302 sh Configure -Dinc_version_list=none ...
303
304When using the newer perl, you can add these pathes again in the
305$PERL5LIB environment variable or with perl's -I runtime option.
306
1b1c1ae2
GS
307=head2 Altering config.sh variables for C compiler switches etc.
308
309For most users, all of the Configure defaults are fine. Configure
cc65bb49 310also has several convenient options which are described below.
1b1c1ae2
GS
311However, if Configure doesn't have an option to do what you want,
312you can change Configure variables after the platform hints have been
313run, by using Configure's -A switch. For example, here's how to add
314a couple of extra flags to C compiler invocations:
315
316 sh Configure -Accflags="-DPERL_Y2KWARN -DPERL_POLLUTE_MALLOC"
317
318For more help on Configure switches, run:
319
320 sh Configure -h
321
844fc9f4
JH
322=head2 Building Perl outside of the source directory
323
324Sometimes it is desirable to build Perl in a directory different from
325where the sources are, for example if you want to keep your sources
326read-only, or if you want to share the sources between different binary
cc65bb49
AD
327architectures. You can do this (if your file system supports symbolic
328links) by
5cda700b 329
844fc9f4
JH
330 mkdir /tmp/perl/build/directory
331 cd /tmp/perl/build/directory
332 sh /path/to/perl/source/Configure -Dmksymlinks ...
333
334This will create in /tmp/perl/build/directory a tree of symbolic links
335pointing to files in /path/to/perl/source. The original files are left
336unaffected. After Configure has finished you can just say
337
338 make all test
339
340and Perl will be built and tested, all in /tmp/perl/build/directory.
341
d6baa268
JH
342=head2 Common Configure options
343
fb73857a
PP
344Configure supports a number of useful options. Run B<Configure -h> to
345get a listing. See the Porting/Glossary file for a complete list of
346Configure variables you can set and their definitions.
347
d6baa268
JH
348=over 4
349
350=item gcc
351
352To compile with gcc you should run
8e07c86e
AD
353
354 sh Configure -Dcc=gcc
355
356This is the preferred way to specify gcc (or another alternative
357compiler) so that the hints files can set appropriate defaults.
358
d6baa268 359=item Installation prefix
4633a7c4 360
8e07c86e 361By default, for most systems, perl will be installed in
8d74ce1c
AD
362/usr/local/{bin, lib, man}. (See L<"Installation Directories">
363and L<"Coexistence with earlier versions of perl5"> below for
364further details.)
365
366You can specify a different 'prefix' for the default installation
367directory, when Configure prompts you or by using the Configure command
368line option -Dprefix='/some/directory', e.g.
8e07c86e 369
25f94b33 370 sh Configure -Dprefix=/opt/perl
4633a7c4 371
d6baa268
JH
372If your prefix contains the string "perl", then the suggested
373directory structure is simplified. For example, if you use
374prefix=/opt/perl, then Configure will suggest /opt/perl/lib instead of
375/opt/perl/lib/perl5/. Again, see L<"Installation Directories"> below
bc70e9ec
JH
376for more details. Do not include a trailing slash, (i.e. /opt/perl/)
377or you may experience odd test failures.
8e07c86e 378
8d74ce1c
AD
379NOTE: You must not specify an installation directory that is the same
380as or below your perl source directory. If you do, installperl will
381attempt infinite recursion.
84902520 382
d6baa268
JH
383=item /usr/bin/perl
384
385It may seem obvious, but Perl is useful only when users can easily
386find it. It's often a good idea to have both /usr/bin/perl and
dd64f1c3 387/usr/local/bin/perl be symlinks to the actual binary. Be especially
d6baa268 388careful, however, not to overwrite a version of perl supplied by your
b66c6cec
AD
389vendor unless you are sure you know what you are doing. If you insist
390on replacing your vendor's perl, useful information on how it was
391configured may be found with
392
393 perl -V:config_args
394
395(Check the output carefully, however, since this doesn't preserve
396spaces in arguments to Configure. For that, you have to look
397carefully at config_arg1, config_arg2, etc.)
d6baa268 398
7d56c962
RGS
399By default, Configure will not try to link /usr/bin/perl to
400the current version of perl. You can turn on that behavior by running
d6baa268 401
7d56c962 402 Configure -Dinstallusrbinperl
d6baa268 403
7d56c962
RGS
404or by answering 'yes' to the appropriate Configure prompt.
405(Note that before perl 5.8.1, the default behavior was to create
406or overwrite /usr/bin/perl even if it already existed.)
d6baa268
JH
407
408In any case, system administrators are strongly encouraged to
dd64f1c3 409put (symlinks to) perl and its accompanying utilities, such as perldoc,
4682965a
MB
410into a directory typically found along a user's PATH, or in another
411obvious and convenient place.
412
d6baa268 413=item Overriding an old config.sh
04d420f9 414
d6baa268
JH
415If you want to use your old config.sh but override some of the items
416with command line options, you need to use B<Configure -O>.
417
418=back
8e07c86e 419
203c3eec
AD
420If you are willing to accept all the defaults, and you want terse
421output, you can run
422
423 sh Configure -des
424
cc65bb49 425Note: for development releases (odd subreleases, like 5.9, as opposed
fe23a901 426to maintenance releases which have even subreleases, like 5.6 and 5.8)
b88cc0eb
JH
427if you want to use Configure -d, you will also need to supply -Dusedevel
428to Configure, because the default answer to the question "do you really
429want to Configure a development version?" is "no". The -Dusedevel
430skips that sanity check.
431
432For example for my Solaris system, I usually use
203c3eec
AD
433
434 sh Configure -Dprefix=/opt/perl -Doptimize='-xpentium -xO4' -des
435
46bb10fb
CS
436=head2 GNU-style configure
437
1ec51d55 438If you prefer the GNU-style configure command line interface, you can
dc45a647 439use the supplied configure.gnu command, e.g.
46bb10fb 440
693762b4 441 CC=gcc ./configure.gnu
46bb10fb 442
dc45a647 443The configure.gnu script emulates a few of the more common configure
46bb10fb
CS
444options. Try
445
693762b4 446 ./configure.gnu --help
46bb10fb
CS
447
448for a listing.
449
dc45a647 450(The file is called configure.gnu to avoid problems on systems
693762b4 451that would not distinguish the files "Configure" and "configure".)
46bb10fb 452
cc65bb49
AD
453See L<Cross-compilation> below for information on cross-compiling.
454
aa689395 455=head2 Installation Directories
4633a7c4
LW
456
457The installation directories can all be changed by answering the
458appropriate questions in Configure. For convenience, all the
459installation questions are near the beginning of Configure.
cc65bb49 460Do not include trailing slashes on directory names.
4633a7c4 461
7beaa944
AD
462I highly recommend running Configure interactively to be sure it puts
463everything where you want it. At any point during the Configure
d6baa268 464process, you can answer a question with &-d and Configure will use
cc65bb49
AD
465the defaults from then on. Alternatively, you can
466
467 grep '^install' config.sh
468
469after Configure has run to verify the installation paths.
d6baa268
JH
470
471The defaults are intended to be reasonable and sensible for most
472people building from sources. Those who build and distribute binary
473distributions or who export perl to a range of systems will probably
474need to alter them. If you are content to just accept the defaults,
475you can safely skip the next section.
476
477The directories set up by Configure fall into three broad categories.
478
479=over 4
480
481=item Directories for the perl distribution
482
9a664500 483By default, Configure will use the following directories for 5.9.0.
d6baa268 484$version is the full perl version number, including subversion, e.g.
9a664500 4855.9.0 or 5.9.1, and $archname is a string like sun4-sunos,
d6baa268
JH
486determined by Configure. The full definitions of all Configure
487variables are in the file Porting/Glossary.
488
489 Configure variable Default value
b367e8b0
NC
490 $prefixexp /usr/local
491 $binexp $prefixexp/bin
492 $scriptdirexp $prefixexp/bin
493 $privlibexp $prefixexp/lib/perl5/$version
494 $archlibexp $prefixexp/lib/perl5/$version/$archname
495 $man1direxp $prefixexp/man/man1
496 $man3direxp $prefixexp/man/man3
497 $html1direxp (none)
498 $html3direxp (none)
499
500$prefixexp is generated from $prefix, with ~ expansion done to convert home
501directories into absolute paths. Similarly for the other variables listed. As
502file system calls do not do this, you should always reference the ...exp
503variables, to support users who build perl in their home directory.
d6baa268
JH
504
505Actually, Configure recognizes the SVR3-style
506/usr/local/man/l_man/man1 directories, if present, and uses those
507instead. Also, if $prefix contains the string "perl", the library
508directories are simplified as described below. For simplicity, only
509the common style is shown here.
510
511=item Directories for site-specific add-on files
512
513After perl is installed, you may later wish to add modules (e.g. from
514CPAN) or scripts. Configure will set up the following directories to
c42e3e15 515be used for installing those add-on modules and scripts.
d6baa268
JH
516
517 Configure variable Default value
b367e8b0
NC
518 $siteprefixexp $prefixexp
519 $sitebinexp $siteprefixexp/bin
520 $sitescriptexp $siteprefixexp/bin
521 $sitelibexp $siteprefixexp/lib/perl5/site_perl/$version
522 $sitearchexp $siteprefixexp/lib/perl5/site_perl/$version/$archname
523 $siteman1direxp $siteprefixexp/man/man1
524 $siteman3direxp $siteprefixexp/man/man3
525 $sitehtml1direxp (none)
526 $sitehtml3direxp (none)
d6baa268
JH
527
528By default, ExtUtils::MakeMaker will install architecture-independent
273cf8d1 529modules into $sitelib and architecture-dependent modules into $sitearch.
d6baa268
JH
530
531=item Directories for vendor-supplied add-on files
532
533Lastly, if you are building a binary distribution of perl for
534distribution, Configure can optionally set up the following directories
535for you to use to distribute add-on modules.
536
537 Configure variable Default value
b367e8b0 538 $vendorprefixexp (none)
d6baa268 539 (The next ones are set only if vendorprefix is set.)
b367e8b0
NC
540 $vendorbinexp $vendorprefixexp/bin
541 $vendorscriptexp $vendorprefixexp/bin
542 $vendorlibexp
543 $vendorprefixexp/lib/perl5/vendor_perl/$version
544 $vendorarchexp
545 $vendorprefixexp/lib/perl5/vendor_perl/$version/$archname
546 $vendorman1direxp $vendorprefixexp/man/man1
547 $vendorman3direxp $vendorprefixexp/man/man3
548 $vendorhtml1direxp (none)
549 $vendorhtml3direxp (none)
d6baa268
JH
550
551These are normally empty, but may be set as needed. For example,
552a vendor might choose the following settings:
553
b367e8b0
NC
554 $prefix /usr
555 $siteprefix /usr/local
556 $vendorprefix /usr
d6baa268
JH
557
558This would have the effect of setting the following:
559
b367e8b0
NC
560 $binexp /usr/bin
561 $scriptdirexp /usr/bin
562 $privlibexp /usr/lib/perl5/$version
563 $archlibexp /usr/lib/perl5/$version/$archname
564 $man1direxp /usr/man/man1
565 $man3direxp /usr/man/man3
566
567 $sitebinexp /usr/local/bin
568 $sitescriptexp /usr/local/bin
569 $sitelibexp /usr/local/lib/perl5/site_perl/$version
570 $sitearchexp /usr/local/lib/perl5/site_perl/$version/$archname
571 $siteman1direxp /usr/local/man/man1
572 $siteman3direxp /usr/local/man/man3
573
574 $vendorbinexp /usr/bin
575 $vendorscriptexp /usr/bin
576 $vendorlibexp /usr/lib/perl5/vendor_perl/$version
577 $vendorarchexp /usr/lib/perl5/vendor_perl/$version/$archname
578 $vendorman1direxp /usr/man/man1
579 $vendorman3direxp /usr/man/man3
d6baa268
JH
580
581Note how in this example, the vendor-supplied directories are in the
582/usr hierarchy, while the directories reserved for the end-user are in
273cf8d1
GS
583the /usr/local hierarchy.
584
585The entire installed library hierarchy is installed in locations with
586version numbers, keeping the installations of different versions distinct.
587However, later installations of Perl can still be configured to search the
588installed libraries corresponding to compatible earlier versions.
589See L<"Coexistence with earlier versions of perl5"> below for more details
590on how Perl can be made to search older version directories.
d6baa268
JH
591
592Of course you may use these directories however you see fit. For
593example, you may wish to use $siteprefix for site-specific files that
594are stored locally on your own disk and use $vendorprefix for
595site-specific files that are stored elsewhere on your organization's
596network. One way to do that would be something like
597
598 sh Configure -Dsiteprefix=/usr/local -Dvendorprefix=/usr/share/perl
599
600=item otherlibdirs
601
602As a final catch-all, Configure also offers an $otherlibdirs
603variable. This variable contains a colon-separated list of additional
3b777bb4
GS
604directories to add to @INC. By default, it will be empty.
605Perl will search these directories (including architecture and
606version-specific subdirectories) for add-on modules and extensions.
d6baa268 607
f1300be0 608For example, if you have a bundle of perl libraries from a previous
fe23a901
RF
609installation, perhaps in a strange place:
610
9a664500 611 Configure -Dotherlibdirs=/usr/lib/perl5/site_perl/5.8.1
fe23a901 612
a61357a9
JA
613=item APPLLIB_EXP
614
615There is one other way of adding paths to @INC at perl build time, and
616that is by setting the APPLLIB_EXP C pre-processor token to a colon-
617separated list of directories, like this
618
619 sh Configure -Accflags='-DAPPLLIB_EXP=\"/usr/libperl\"'
620
621The directories defined by APPLLIB_EXP get added to @INC I<first>,
622ahead of any others, and so provide a way to override the standard perl
623modules should you, for example, want to distribute fixes without
624touching the perl distribution proper. And, like otherlib dirs,
625version and architecture specific subdirectories are also searched, if
626present, at run time. Of course, you can still search other @INC
627directories ahead of those in APPLLIB_EXP by using any of the standard
628run-time methods: $PERLLIB, $PERL5LIB, -I, use lib, etc.
629
d6baa268 630=item Man Pages
1ec51d55 631
d6baa268
JH
632In versions 5.005_57 and earlier, the default was to store module man
633pages in a version-specific directory, such as
634/usr/local/lib/perl5/$version/man/man3. The default for 5.005_58 and
635after is /usr/local/man/man3 so that most users can find the man pages
636without resetting MANPATH.
4633a7c4 637
d6baa268 638You can continue to use the old default from the command line with
4633a7c4 639
9a664500 640 sh Configure -Dman3dir=/usr/local/lib/perl5/5.9.0/man/man3
8d74ce1c 641
d6baa268
JH
642Some users also prefer to use a .3pm suffix. You can do that with
643
644 sh Configure -Dman3ext=3pm
645
646Again, these are just the defaults, and can be changed as you run
647Configure.
648
649=item HTML pages
650
cc65bb49
AD
651Currently, the standard perl installation does not do anything with
652HTML documentation, but that may change in the future. Further, some
653add-on modules may wish to install HTML documents. The html Configure
654variables listed above are provided if you wish to specify where such
655documents should be placed. The default is "none", but will likely
656eventually change to something useful based on user feedback.
8d74ce1c 657
d6baa268 658=back
8d74ce1c 659
3a6175e1
AD
660Some users prefer to append a "/share" to $privlib and $sitelib
661to emphasize that those directories can be shared among different
662architectures.
4633a7c4 663
8d74ce1c
AD
664Note that these are just the defaults. You can actually structure the
665directories any way you like. They don't even have to be on the same
666filesystem.
667
668Further details about the installation directories, maintenance and
669development subversions, and about supporting multiple versions are
670discussed in L<"Coexistence with earlier versions of perl5"> below.
671
672If you specify a prefix that contains the string "perl", then the
d6baa268
JH
673library directory structure is slightly simplified. Instead of
674suggesting $prefix/lib/perl5/, Configure will suggest $prefix/lib.
8d74ce1c 675
d6baa268 676Thus, for example, if you Configure with
9a664500 677-Dprefix=/opt/perl, then the default library directories for 5.9.0 are
3a6175e1 678
d6baa268 679 Configure variable Default value
9a664500
AMS
680 $privlib /opt/perl/lib/5.9.0
681 $archlib /opt/perl/lib/5.9.0/$archname
682 $sitelib /opt/perl/lib/site_perl/5.9.0
683 $sitearch /opt/perl/lib/site_perl/5.9.0/$archname
4633a7c4 684
aa689395
PP
685=head2 Changing the installation directory
686
687Configure distinguishes between the directory in which perl (and its
688associated files) should be installed and the directory in which it
689will eventually reside. For most sites, these two are the same; for
690sites that use AFS, this distinction is handled automatically.
1ec51d55 691However, sites that use software such as depot to manage software
d6baa268
JH
692packages, or users building binary packages for distribution may also
693wish to install perl into a different directory and use that
694management software to move perl to its final destination. This
695section describes how to do that.
aa689395 696
0dcb58f4 697Suppose you want to install perl under the /tmp/perl5 directory. You
d6baa268
JH
698could edit config.sh and change all the install* variables to point to
699/tmp/perl5 instead of /usr/local, or you could simply use the
700following command line:
701
702 sh Configure -Dinstallprefix=/tmp/perl5
703
704(replace /tmp/perl5 by a directory of your choice).
aa689395 705
693762b4 706Beware, though, that if you go to try to install new add-on
d6baa268 707modules, they too will get installed in under '/tmp/perl5' if you
693762b4
AD
708follow this example. The next section shows one way of dealing with
709that problem.
710
aa689395
PP
711=head2 Creating an installable tar archive
712
713If you need to install perl on many identical systems, it is
714convenient to compile it once and create an archive that can be
d6c1b5d3
AD
715installed on multiple systems. Suppose, for example, that you want to
716create an archive that can be installed in /opt/perl.
717Here's one way to do that:
aa689395 718
d6baa268 719 # Set up to install perl into a different directory,
aa689395 720 # e.g. /tmp/perl5 (see previous part).
d6baa268 721 sh Configure -Dinstallprefix=/tmp/perl5 -Dprefix=/opt/perl -des
aa689395
PP
722 make
723 make test
d6c1b5d3 724 make install # This will install everything into /tmp/perl5.
aa689395 725 cd /tmp/perl5
d6c1b5d3 726 # Edit $archlib/Config.pm and $archlib/.packlist to change all the
fb73857a 727 # install* variables back to reflect where everything will
d6c1b5d3
AD
728 # really be installed. (That is, change /tmp/perl5 to /opt/perl
729 # everywhere in those files.)
730 # Check the scripts in $scriptdir to make sure they have the correct
bfb7748a 731 # #!/wherever/perl line.
aa689395
PP
732 tar cvf ../perl5-archive.tar .
733 # Then, on each machine where you want to install perl,
d6c1b5d3 734 cd /opt/perl # Or wherever you specified as $prefix
aa689395
PP
735 tar xvf perl5-archive.tar
736
5c8863fa
JH
737Alternatively, the DESTDIR variable is honored during C<make install>.
738The DESTDIR is automatically prepended to all the installation paths
739(and there is no need to edit anything). With DESTDIR, the above
740example can we written as:
5a9231b0
MS
741
742 sh Configure -Dprefix=/opt/perl -des
743 make
744 make test
745 make install DESTDIR=/tmp/perl5
746 cd /tmp/perl5/opt/perl
747 tar cvf /tmp/perl5-archive.tar .
748
dc45a647 749=head2 Site-wide Policy settings
693762b4
AD
750
751After Configure runs, it stores a number of common site-wide "policy"
752answers (such as installation directories and the local perl contact
753person) in the Policy.sh file. If you want to build perl on another
754system using the same policy defaults, simply copy the Policy.sh file
755to the new system and Configure will use it along with the appropriate
756hint file for your system.
757
dc45a647
MB
758Alternatively, if you wish to change some or all of those policy
759answers, you should
760
761 rm -f Policy.sh
762
763to ensure that Configure doesn't re-use them.
764
765Further information is in the Policy_sh.SH file itself.
766
8d74ce1c
AD
767If the generated Policy.sh file is unsuitable, you may freely edit it
768to contain any valid shell commands. It will be run just after the
769platform-specific hints files.
770
aa689395
PP
771=head2 Configure-time Options
772
773There are several different ways to Configure and build perl for your
774system. For most users, the defaults are sensible and will work.
775Some users, however, may wish to further customize perl. Here are
776some of the main things you can change.
777
693762b4 778=head2 Threads
aa689395 779
cc65bb49
AD
780On some platforms, perl can be compiled with
781support for threads. To enable this, run
f7542a9d 782
693762b4 783 sh Configure -Dusethreads
aa689395 784
693762b4
AD
785Currently, you need to specify -Dusethreads on the Configure command
786line so that the hint files can make appropriate adjustments.
787
788The default is to compile without thread support.
3fe9a6f1 789
6d5328bc
JH
790Perl has two different internal threads implementations. The current
791model (available internally since 5.6, and as a user-level module
792since 5.8) is called interpreter-based implementation (ithreads),
793with one interpreter per thread, and explicit sharing of data.
aaacdc8b 794
6d5328bc
JH
795The 5.005 version (5005threads) is considered obsolete, buggy, and
796unmaintained.
797
798By default, Configure selects ithreads if -Dusethreads is specified.
aaacdc8b 799
cc65bb49 800(You need to also use the PerlIO layer, explained later, if you decide
b29b105d
JH
801to use ithreads, to guarantee the good interworking of threads and I/O.)
802
cc65bb49 803However, if you wish, you can select the unsupported old 5005threads behavior
aaacdc8b 804
6d5328bc
JH
805 sh Configure -Dusethreads -Duse5005threads
806
807If you decide to use ithreads, the 'threads' module allows their use,
808and the 'Thread' module offers an interface to both 5005threads and
809ithreads (whichever has been configured).
aaacdc8b 810
af685957
JH
811When building threaded for certain library calls like the getgr*() and
812the getpw*() there is a dynamically sized result buffer: the buffer
813starts small but Perl will keep growing the buffer until the result fits.
814To get a fixed upper limit you will have to recompile Perl with
815PERL_REENTRANT_MAXSIZE defined to be the number of bytes you want.
816One way to do this is to run Configure with
817C<-Accflags=-DPERL_REENTRANT_MAXSIZE=65536>
818
766b63c4
JH
819=head2 Large file support.
820
5cda700b 821Since Perl 5.6.0, Perl has supported large files (files larger than
766b63c4
JH
8222 gigabytes), and in many common platforms like Linux or Solaris this
823support is on by default.
824
825This is both good and bad. It is good in that you can use large files,
5cda700b
AD
826seek(), stat(), and -s them. It is bad in that if you are interfacing Perl
827using some extension, the components you are connecting to must also
766b63c4
JH
828be large file aware: if Perl thinks files can be large but the other
829parts of the software puzzle do not understand the concept, bad things
830will happen. One popular extension suffering from this ailment is the
831Apache extension mod_perl.
832
833There's also one known limitation with the current large files
834implementation: unless you also have 64-bit integers (see the next
835section), you cannot use the printf/sprintf non-decimal integer
836formats like C<%x> to print filesizes. You can use C<%d>, though.
837
9d5a2765
A
838=head2 64 bit support.
839
766b63c4
JH
840If your platform does not have 64 bits natively, but can simulate them
841with compiler flags and/or C<long long> or C<int64_t>, you can build a
842perl that uses 64 bits.
9d5a2765
A
843
844There are actually two modes of 64-bitness: the first one is achieved
845using Configure -Duse64bitint and the second one using Configure
846-Duse64bitall. The difference is that the first one is minimal and
847the second one maximal. The first works in more places than the second.
848
849The C<use64bitint> does only as much as is required to get 64-bit
850integers into Perl (this may mean, for example, using "long longs")
851while your memory may still be limited to 2 gigabytes (because your
852pointers could still be 32-bit). Note that the name C<64bitint> does
853not imply that your C compiler will be using 64-bit C<int>s (it might,
854but it doesn't have to): the C<use64bitint> means that you will be
855able to have 64 bits wide scalar values.
856
857The C<use64bitall> goes all the way by attempting to switch also
858integers (if it can), longs (and pointers) to being 64-bit. This may
859create an even more binary incompatible Perl than -Duse64bitint: the
860resulting executable may not run at all in a 32-bit box, or you may
861have to reboot/reconfigure/rebuild your operating system to be 64-bit
862aware.
863
864Natively 64-bit systems like Alpha and Cray need neither -Duse64bitint
865nor -Duse64bitall.
866
867 NOTE: 64-bit support is still experimental on most platforms.
868 Existing support only covers the LP64 data model. In particular, the
869 LLP64 data model is not yet supported. 64-bit libraries and system
870 APIs on many platforms have not stabilized--your mileage may vary.
871
872=head2 Long doubles
873
874In some systems you may be able to use long doubles to enhance the
875range and precision of your double precision floating point numbers
876(that is, Perl's numbers). Use Configure -Duselongdouble to enable
877this support (if it is available).
878
879=head2 "more bits"
880
881You can "Configure -Dusemorebits" to turn on both the 64-bit support
882and the long double support.
883
46bb10fb
CS
884=head2 Selecting File IO mechanisms
885
9a664500 886Executive summary: as of Perl 5.8, you should use the default "PerlIO"
dd2bab0f
JH
887as the IO mechanism unless you have a good reason not to.
888
889In more detail: previous versions of perl used the standard IO
890mechanisms as defined in stdio.h. Versions 5.003_02 and later of perl
365d6a78
PN
891introduced alternate IO mechanisms via a "PerlIO" abstraction, but up
892until and including Perl 5.6, the stdio mechanism was still the default
893and the only supported mechanism.
46bb10fb 894
365d6a78 895Starting from Perl 5.8, the default mechanism is to use the PerlIO
6d5328bc
JH
896abstraction, because it allows better control of I/O mechanisms,
897instead of having to work with (often, work around) vendors' I/O
898implementations.
46bb10fb 899
365d6a78
PN
900This PerlIO abstraction can be (but again, unless you know what you
901are doing, should not be) disabled either on the Configure command
902line with
46bb10fb 903
6d5328bc 904 sh Configure -Uuseperlio
46bb10fb 905
6d5328bc 906or interactively at the appropriate Configure prompt.
46bb10fb 907
6d5328bc
JH
908With the PerlIO abstraction layer, there is another possibility for
909the underlying IO calls, AT&T's "sfio". This has superior performance
910to stdio.h in many cases, and is extensible by the use of "discipline"
911modules ("Native" PerlIO has them too). Sfio currently only builds on
912a subset of the UNIX platforms perl supports. Because the data
913structures are completely different from stdio, perl extension modules
914or external libraries may not work. This configuration exists to
915allow these issues to be worked on.
46bb10fb
CS
916
917This option requires the 'sfio' package to have been built and installed.
1b9c9cf5 918The latest sfio is available from http://www.research.att.com/sw/tools/sfio/
46bb10fb
CS
919
920You select this option by
921
922 sh Configure -Duseperlio -Dusesfio
923
924If you have already selected -Duseperlio, and if Configure detects
925that you have sfio, then sfio will be the default suggested by
926Configure.
927
d6baa268
JH
928Note: On some systems, sfio's iffe configuration script fails to
929detect that you have an atexit function (or equivalent). Apparently,
930this is a problem at least for some versions of Linux and SunOS 4.
931Configure should detect this problem and warn you about problems with
932_exit vs. exit. If you have this problem, the fix is to go back to
933your sfio sources and correct iffe's guess about atexit.
33e6ee5f 934
504f80c1
JH
935=head2 Algorithmic Complexity Attacks on Hashes
936
937In Perls 5.8.0 and earlier it was easy to create degenerate hashes.
938Processing such hashes would consume large amounts of CPU time,
3debabd9 939enabling a "Denial of Service" attack against Perl. Such hashes may be
504f80c1
JH
940a problem for example for mod_perl sites, sites with Perl CGI scripts
941and web services, that process data originating from external sources.
942
86358043
NC
943In Perl 5.8.1 a security feature was introduced to make it harder to
944create such degenerate hashes. A visible side effect of this was that
945the keys(), values(), and each() functions may return the hash elements
946in different order between different runs of Perl even with the same
947data. It also had unintended binary incompatibility issues with
948certain modules compiled against Perl 5.8.0.
949
950In Perl 5.8.2 an improved scheme was introduced. Hashes will return
951elements in the same order as Perl 5.8.0 by default. On a hash by hash
952basis, if pathological data is detected during a hash key insertion,
953then that hash will switch to an alternative random hash seed. As
954adding keys can always dramatically change returned hash element order,
955existing programs will not be affected by this, unless they
956specifically test for pre-recorded hash return order for contrived
957data. (eg the list of keys generated by C<map {"\0"x$_} 0..15> trigger
958randomisation) In effect the new implementation means that 5.8.1 scheme
959is only being used on hashes which are under attack.
960
961One can still revert to the old guaranteed repeatable order (and be
962vulnerable to attack by wily crackers) by setting the environment
963variable PERL_HASH_SEED, see L<perlrun/PERL_HASH_SEED>. Another option
964is to add -DUSE_HASH_SEED_EXPLICIT to the compilation flags (for
965example by using C<Configure -Accflags=-DUSE_HAS_SEED_EXPLICIT>), in
966which case one has to explicitly set the PERL_HASH_SEED environment
967variable to enable the security feature, or by adding -DNO_HASH_SEED to
968the compilation flags to completely disable the randomisation feature.
504f80c1 969
3debabd9 970B<Perl has never guaranteed any ordering of the hash keys>, and the
86358043
NC
971ordering has already changed several times during the lifetime of Perl
9725. Also, the ordering of hash keys has always been, and continues to
973be, affected by the insertion order. It is likely that Perl 5.10 and
974Perl 6 will randomise all hashes. Note that because of this
975randomisation for example the Data::Dumper results will be different
976between different runs of Perl since Data::Dumper by default dumps
977hashes "unordered". The use of the Data::Dumper C<Sortkeys> option is
978recommended.
504f80c1 979
1b9c9cf5
DH
980=head2 SOCKS
981
982Perl can be configured to be 'socksified', that is, to use the SOCKS
983TCP/IP proxy protocol library. SOCKS is used to give applications
984access to transport layer network proxies. Perl supports only SOCKS
985Version 5. You can find more about SOCKS from http://www.socks.nec.com/
986
d6baa268
JH
987=head2 Dynamic Loading
988
989By default, Configure will compile perl to use dynamic loading if
990your system supports it. If you want to force perl to be compiled
991statically, you can either choose this when Configure prompts you or
992you can use the Configure command line option -Uusedl.
993
10c7e831 994=head2 Building a shared Perl library
c3edaffb
PP
995
996Currently, for most systems, the main perl executable is built by
997linking the "perl library" libperl.a with perlmain.o, your static
998extensions (usually just DynaLoader.a) and various extra libraries,
999such as -lm.
1000
9d67150a
PP
1001On some systems that support dynamic loading, it may be possible to
1002replace libperl.a with a shared libperl.so. If you anticipate building
c3edaffb
PP
1003several different perl binaries (e.g. by embedding libperl into
1004different programs, or by using the optional compiler extension), then
9d67150a 1005you might wish to build a shared libperl.so so that all your binaries
c3edaffb
PP
1006can share the same library.
1007
1008The disadvantages are that there may be a significant performance
9d67150a 1009penalty associated with the shared libperl.so, and that the overall
aa689395 1010mechanism is still rather fragile with respect to different versions
c3edaffb
PP
1011and upgrades.
1012
1013In terms of performance, on my test system (Solaris 2.5_x86) the perl
9d67150a 1014test suite took roughly 15% longer to run with the shared libperl.so.
c3edaffb
PP
1015Your system and typical applications may well give quite different
1016results.
1017
1018The default name for the shared library is typically something like
a6006777 1019libperl.so.3.2 (for Perl 5.003_02) or libperl.so.302 or simply
9d67150a 1020libperl.so. Configure tries to guess a sensible naming convention
c3edaffb
PP
1021based on your C library name. Since the library gets installed in a
1022version-specific architecture-dependent directory, the exact name
1023isn't very important anyway, as long as your linker is happy.
1024
1025For some systems (mostly SVR4), building a shared libperl is required
1026for dynamic loading to work, and hence is already the default.
1027
1028You can elect to build a shared libperl by
1029
1030 sh Configure -Duseshrplib
1031
2bf2710f
GS
1032To build a shared libperl, the environment variable controlling shared
1033library search (LD_LIBRARY_PATH in most systems, DYLD_LIBRARY_PATH for
78be1e1a
JH
1034NeXTSTEP/OPENSTEP/Darwin, LIBRARY_PATH for BeOS, LD_LIBRARY_PATH/SHLIB_PATH
1035for HP-UX, LIBPATH for AIX, PATH for Cygwin) must be set up to include
2bf2710f 1036the Perl build directory because that's where the shared libperl will
d6baa268 1037be created. Configure arranges makefile to have the correct shared
10c7e831
JH
1038library search settings. You can find the name of the environment
1039variable Perl thinks works in your your system by
1040
1041 grep ldlibpthname config.sh
2bf2710f
GS
1042
1043However, there are some special cases where manually setting the
1044shared library path might be required. For example, if you want to run
1045something like the following with the newly-built but not-yet-installed
1046./perl:
1047
1048 cd t; ./perl misc/failing_test.t
1049or
1050 ./perl -Ilib ~/my_mission_critical_test
1051
1052then you need to set up the shared library path explicitly.
1053You can do this with
c3edaffb
PP
1054
1055 LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
1056
1057for Bourne-style shells, or
1058
1059 setenv LD_LIBRARY_PATH `pwd`
1060
2bf2710f 1061for Csh-style shells. (This procedure may also be needed if for some
10c7e831 1062unexpected reason Configure fails to set up makefile correctly.) (And
5cda700b 1063again, it may be something other than LD_LIBRARY_PATH for you, see above.)
2bf2710f
GS
1064
1065You can often recognize failures to build/use a shared libperl from error
1066messages complaining about a missing libperl.so (or libperl.sl in HP-UX),
1067for example:
106818126:./miniperl: /sbin/loader: Fatal Error: cannot map libperl.so
c3edaffb 1069
9d67150a
PP
1070There is also an potential problem with the shared perl library if you
1071want to have more than one "flavor" of the same version of perl (e.g.
1072with and without -DDEBUGGING). For example, suppose you build and
cc65bb49
AD
1073install a standard Perl 5.8.0 with a shared library. Then, suppose you
1074try to build Perl 5.8.0 with -DDEBUGGING enabled, but everything else
9d67150a
PP
1075the same, including all the installation directories. How can you
1076ensure that your newly built perl will link with your newly built
cc65bb49 1077libperl.so.8 rather with the installed libperl.so.8? The answer is
9d67150a 1078that you might not be able to. The installation directory is encoded
56c6f531
JH
1079in the perl binary with the LD_RUN_PATH environment variable (or
1080equivalent ld command-line option). On Solaris, you can override that
1ff4263c
CT
1081with LD_LIBRARY_PATH; on Linux, you can only override at runtime via
1082LD_PRELOAD, specifying the exact filename you wish to be used; and on
1083Digital Unix, you can override LD_LIBRARY_PATH by setting the
1084_RLD_ROOT environment variable to point to the perl build directory.
9d67150a 1085
830717a7
AD
1086In other words, it is generally not a good idea to try to build a perl
1087with a shared library if $archlib/CORE/$libperl already exists from a
1088previous build.
1089
1090A good workaround is to specify a different directory for the
1091architecture-dependent library for your -DDEBUGGING version of perl.
1092You can do this by changing all the *archlib* variables in config.sh to
1093point to your new architecture-dependent library.
9d67150a 1094
55479bb6
AD
1095=head2 Malloc Issues
1096
d6baa268
JH
1097Perl relies heavily on malloc(3) to grow data structures as needed,
1098so perl's performance can be noticeably affected by the performance of
1099the malloc function on your system. The perl source is shipped with a
1100version of malloc that has been optimized for the typical requests from
1101perl, so there's a chance that it may be both faster and use less memory
1102than your system malloc.
55479bb6 1103
d6baa268
JH
1104However, if your system already has an excellent malloc, or if you are
1105experiencing difficulties with extensions that use third-party libraries
1106that call malloc, then you should probably use your system's malloc.
1107(Or, you might wish to explore the malloc flags discussed below.)
c3edaffb 1108
aa689395
PP
1109=over 4
1110
d6baa268 1111=item Using the system malloc
2ae324a7 1112
d6baa268 1113To build without perl's malloc, you can use the Configure command
aa689395 1114
d6baa268 1115 sh Configure -Uusemymalloc
aa689395 1116
d6baa268 1117or you can answer 'n' at the appropriate interactive Configure prompt.
aa689395 1118
86058a2d
GS
1119=item -DPERL_POLLUTE_MALLOC
1120
d953f698
JH
1121NOTE: This flag is enabled automatically on some platforms if you just
1122run Configure to accept all the defaults on those platforms.
b2a6d19e 1123
5cda700b
AD
1124Perl's malloc family of functions are normally called Perl_malloc(),
1125Perl_realloc(), Perl_calloc() and Perl_mfree().
1126These names do not clash with the system versions of these functions.
d6baa268 1127
5cda700b
AD
1128If this flag is enabled, however, Perl's malloc family of functions
1129will have the same names as the system versions. This may be required
1130sometimes if you have libraries that like to free() data that may have
1131been allocated by Perl_malloc() and vice versa.
86058a2d 1132
d6baa268
JH
1133Note that enabling this option may sometimes lead to duplicate symbols
1134from the linker for malloc et al. In such cases, the system probably
1135does not allow its malloc functions to be fully replaced with custom
1136versions.
86058a2d 1137
06c896bb
SH
1138=item -DPERL_DEBUGGING_MSTATS
1139
1140This flag enables debugging mstats, which is required to use the
1141Devel::Peek::mstat() function. You cannot enable this unless you are
1142using Perl's malloc, so a typical Configure command would be
1143
8267c262 1144 sh Configure -Accflags=-DPERL_DEBUGGING_MSTATS -Dusemymalloc='y'
06c896bb
SH
1145
1146to enable this option.
1147
aa689395
PP
1148=back
1149
3bf462b8
CS
1150=head2 Building a debugging perl
1151
1152You can run perl scripts under the perl debugger at any time with
3fe9a6f1 1153B<perl -d your_script>. If, however, you want to debug perl itself,
3bf462b8
CS
1154you probably want to do
1155
1156 sh Configure -Doptimize='-g'
1157
203c3eec
AD
1158This will do two independent things: First, it will force compilation
1159to use cc -g so that you can use your system's debugger on the
1160executable. (Note: Your system may actually require something like
d6baa268
JH
1161cc -g2. Check your man pages for cc(1) and also any hint file for
1162your system.) Second, it will add -DDEBUGGING to your ccflags
1163variable in config.sh so that you can use B<perl -D> to access perl's
1164internal state. (Note: Configure will only add -DDEBUGGING by default
1165if you are not reusing your old config.sh. If you want to reuse your
1166old config.sh, then you can just edit it and change the optimize and
1167ccflags variables by hand and then propagate your changes as shown in
1168L<"Propagating your changes to config.sh"> below.)
203c3eec
AD
1169
1170You can actually specify -g and -DDEBUGGING independently, but usually
1171it's convenient to have both.
3bf462b8
CS
1172
1173If you are using a shared libperl, see the warnings about multiple
a522f097 1174versions of perl under L<Building a shared Perl library>.
3bf462b8 1175
8d74ce1c
AD
1176=head2 Extensions
1177
80c1f5de
AD
1178Perl ships with a number of standard extensions. These are contained
1179in the ext/ subdirectory.
1180
8d74ce1c
AD
1181By default, Configure will offer to build every extension which appears
1182to be supported. For example, Configure will offer to build GDBM_File
1183only if it is able to find the gdbm library. (See examples below.)
8d74ce1c
AD
1184Configure does not contain code to test for POSIX compliance, so POSIX
1185is always built by default as well. If you wish to skip POSIX, you can
1186set the Configure variable useposix=false either in a hint file or from
80c1f5de 1187the Configure command line.
8d74ce1c 1188
c42e3e15
GS
1189If you unpack any additional extensions in the ext/ directory before
1190running Configure, then Configure will offer to build those additional
1191extensions as well. Most users probably shouldn't have to do this --
1192it is usually easier to build additional extensions later after perl
1193has been installed. However, if you wish to have those additional
1194extensions statically linked into the perl binary, then this offers a
1195convenient way to do that in one step. (It is not necessary, however;
1196you can build and install extensions just fine even if you don't have
1197dynamic loading. See lib/ExtUtils/MakeMaker.pm for more details.)
1198
a522f097
AD
1199If you have dynamic loading, another way of specifying extra modules
1200is described in L<"Adding extra modules to the build"> below.
1201
c42e3e15 1202You can learn more about each of the supplied extensions by consulting the
8d74ce1c
AD
1203documentation in the individual .pm modules, located under the
1204ext/ subdirectory.
1205
1206Even if you do not have dynamic loading, you must still build the
1207DynaLoader extension; you should just build the stub dl_none.xs
1208version. (Configure will suggest this as the default.)
1209
7a8675bc
JH
1210To disable certain extensions so that they are not built, use
1211the -Dnoextensions=... and -Donlyextensions=... options. They both
1212accept a space-separated list of extensions. The extensions listed
1213in C<noextensions> are removed from the list of extensions to build,
1214while the C<onlyextensions> is rather more severe and builds only
1215the listed extensions. The latter should be used with extreme caution
1216since certain extensions are used by many other extensions and modules:
1217such modules include Fcntl and IO. The order of processing these
1218options is first C<only> (if present), then C<no> (if present).
1219
1220Another, older way to turn off various extensions (which is still good
1221to know if you have to work with older Perl) exists. Here are the
1222Configure command-line variables you can set to turn off various
1223extensions. All others are included by default.
8d74ce1c 1224
8d74ce1c
AD
1225 DB_File i_db
1226 DynaLoader (Must always be included as a static extension)
8d74ce1c 1227 GDBM_File i_gdbm
8d74ce1c
AD
1228 NDBM_File i_ndbm
1229 ODBM_File i_dbm
1230 POSIX useposix
8d74ce1c
AD
1231 Opcode useopcode
1232 Socket d_socket
a2dab6bc 1233 Threads use5005threads
8d74ce1c
AD
1234
1235Thus to skip the NDBM_File extension, you can use
1236
1237 sh Configure -Ui_ndbm
1238
1239Again, this is taken care of automatically if you don't have the ndbm
1240library.
1241
1242Of course, you may always run Configure interactively and select only
1243the extensions you want.
1244
1245Note: The DB_File module will only work with version 1.x of Berkeley
1246DB or newer releases of version 2. Configure will automatically detect
1247this for you and refuse to try to build DB_File with earlier
1248releases of version 2.
1249
1250If you re-use your old config.sh but change your system (e.g. by
1251adding libgdbm) Configure will still offer your old choices of extensions
1252for the default answer, but it will also point out the discrepancy to
1253you.
1254
80c1f5de 1255Finally, if you have dynamic loading (most modern systems do)
8d74ce1c
AD
1256remember that these extensions do not increase the size of your perl
1257executable, nor do they impact start-up time, so you probably might as
1258well build all the ones that will work on your system.
1259
1260=head2 Including locally-installed libraries
1261
1262Perl5 comes with interfaces to number of database extensions, including
1263dbm, ndbm, gdbm, and Berkeley db. For each extension, if
1264Configure can find the appropriate header files and libraries, it will
1265automatically include that extension. The gdbm and db libraries
1266are not included with perl. See the library documentation for
1267how to obtain the libraries.
1268
d6baa268
JH
1269If your database header (.h) files are not in a directory normally
1270searched by your C compiler, then you will need to include the
1271appropriate -I/your/directory option when prompted by Configure. If
1272your database library (.a) files are not in a directory normally
1273searched by your C compiler and linker, then you will need to include
1274the appropriate -L/your/directory option when prompted by Configure.
1275See the examples below.
8d74ce1c
AD
1276
1277=head2 Examples
1278
1279=over 4
1280
1281=item gdbm in /usr/local
1282
1283Suppose you have gdbm and want Configure to find it and build the
d6baa268 1284GDBM_File extension. This example assumes you have gdbm.h
8d74ce1c
AD
1285installed in /usr/local/include/gdbm.h and libgdbm.a installed in
1286/usr/local/lib/libgdbm.a. Configure should figure all the
1287necessary steps out automatically.
1288
1289Specifically, when Configure prompts you for flags for
1290your C compiler, you should include -I/usr/local/include.
1291
1292When Configure prompts you for linker flags, you should include
1293-L/usr/local/lib.
1294
1295If you are using dynamic loading, then when Configure prompts you for
1296linker flags for dynamic loading, you should again include
1297-L/usr/local/lib.
1298
d6baa268
JH
1299Again, this should all happen automatically. This should also work if
1300you have gdbm installed in any of (/usr/local, /opt/local, /usr/gnu,
1301/opt/gnu, /usr/GNU, or /opt/GNU).
8d74ce1c
AD
1302
1303=item gdbm in /usr/you
1304
1305Suppose you have gdbm installed in some place other than /usr/local/,
1306but you still want Configure to find it. To be specific, assume you
1307have /usr/you/include/gdbm.h and /usr/you/lib/libgdbm.a. You
1308still have to add -I/usr/you/include to cc flags, but you have to take
1309an extra step to help Configure find libgdbm.a. Specifically, when
1310Configure prompts you for library directories, you have to add
1311/usr/you/lib to the list.
1312
1313It is possible to specify this from the command line too (all on one
1314line):
1315
d6baa268 1316 sh Configure -de \
8d74ce1c
AD
1317 -Dlocincpth="/usr/you/include" \
1318 -Dloclibpth="/usr/you/lib"
1319
1320locincpth is a space-separated list of include directories to search.
1321Configure will automatically add the appropriate -I directives.
1322
1323loclibpth is a space-separated list of library directories to search.
1324Configure will automatically add the appropriate -L directives. If
1325you have some libraries under /usr/local/ and others under
1326/usr/you, then you have to include both, namely
1327
d6baa268 1328 sh Configure -de \
8d74ce1c
AD
1329 -Dlocincpth="/usr/you/include /usr/local/include" \
1330 -Dloclibpth="/usr/you/lib /usr/local/lib"
1331
1332=back
1333
bb636fa4
JH
1334=head2 Building DB, NDBM, and ODBM interfaces with Berkeley DB 3
1335
1336Perl interface for DB3 is part of Berkeley DB, but if you want to
1337compile standard Perl DB/ODBM/NDBM interfaces, you must follow
1338following instructions.
1339
1340Berkeley DB3 from Sleepycat Software is by default installed without
1341DB1 compatibility code (needed for DB_File interface) and without
1342links to compatibility files. So if you want to use packages written
1343for DB/ODBM/NDBM interfaces, you need to configure DB3 with
1344--enable-compat185 (and optionally with --enable-dump185) and create
1345additional references (suppose you are installing DB3 with
1346--prefix=/usr):
1347
1348 ln -s libdb-3.so /usr/lib/libdbm.so
1349 ln -s libdb-3.so /usr/lib/libndbm.so
f1300be0 1350 echo '#define DB_DBM_HSEARCH 1' >dbm.h
bb636fa4 1351 echo '#include <db.h>' >>dbm.h
f1300be0 1352 install -m 0644 dbm.h /usr/include/dbm.h
bb636fa4
JH
1353 install -m 0644 dbm.h /usr/include/ndbm.h
1354
1355Optionally, if you have compiled with --enable-compat185 (not needed
1356for ODBM/NDBM):
1357
1358 ln -s libdb-3.so /usr/lib/libdb1.so
1359 ln -s libdb-3.so /usr/lib/libdb.so
1360
1361ODBM emulation seems not to be perfect, but is quite usable,
1362using DB 3.1.17:
1363
1364 lib/odbm.............FAILED at test 9
1365 Failed 1/64 tests, 98.44% okay
1366
8e07c86e
AD
1367=head2 What if it doesn't work?
1368
8d74ce1c 1369If you run into problems, try some of the following ideas.
40dd8381 1370If none of them help, then see L<"Reporting Problems"> above.
8d74ce1c 1371
8e07c86e
AD
1372=over 4
1373
25f94b33
AD
1374=item Running Configure Interactively
1375
1376If Configure runs into trouble, remember that you can always run
1377Configure interactively so that you can check (and correct) its
1378guesses.
1379
1380All the installation questions have been moved to the top, so you don't
aa689395 1381have to wait for them. Once you've handled them (and your C compiler and
1ec51d55 1382flags) you can type &-d at the next Configure prompt and Configure
25f94b33
AD
1383will use the defaults from then on.
1384
1385If you find yourself trying obscure command line incantations and
1386config.over tricks, I recommend you run Configure interactively
1387instead. You'll probably save yourself time in the long run.
1388
aa689395 1389=item Hint files
8e07c86e
AD
1390
1391The perl distribution includes a number of system-specific hints files
1392in the hints/ directory. If one of them matches your system, Configure
1393will offer to use that hint file.
1394
1395Several of the hint files contain additional important information.
f5b3b617
AD
1396If you have any problems, it is a good idea to read the relevant hint file
1397for further information. See hints/solaris_2.sh for an extensive example.
1398More information about writing good hints is in the hints/README.hints
1399file.
8e07c86e 1400
edb1cbcb
PP
1401=item *** WHOA THERE!!! ***
1402
1403Occasionally, Configure makes a wrong guess. For example, on SunOS
14044.1.3, Configure incorrectly concludes that tzname[] is in the
1405standard C library. The hint file is set up to correct for this. You
1406will see a message:
1407
1408 *** WHOA THERE!!! ***
1409 The recommended value for $d_tzname on this machine was "undef"!
1410 Keep the recommended value? [y]
1411
1412You should always keep the recommended value unless, after reading the
1413relevant section of the hint file, you are sure you want to try
1414overriding it.
1415
1416If you are re-using an old config.sh, the word "previous" will be
1417used instead of "recommended". Again, you will almost always want
1418to keep the previous value, unless you have changed something on your
1419system.
1420
1421For example, suppose you have added libgdbm.a to your system
1422and you decide to reconfigure perl to use GDBM_File. When you run
1423Configure again, you will need to add -lgdbm to the list of libraries.
bfb7748a
AD
1424Now, Configure will find your gdbm include file and library and will
1425issue a message:
edb1cbcb
PP
1426
1427 *** WHOA THERE!!! ***
1428 The previous value for $i_gdbm on this machine was "undef"!
1429 Keep the previous value? [y]
1430
1ec51d55 1431In this case, you do not want to keep the previous value, so you
c3edaffb 1432should answer 'n'. (You'll also have to manually add GDBM_File to
edb1cbcb
PP
1433the list of dynamic extensions to build.)
1434
8e07c86e
AD
1435=item Changing Compilers
1436
1437If you change compilers or make other significant changes, you should
1ec51d55 1438probably not re-use your old config.sh. Simply remove it or
8e07c86e
AD
1439rename it, e.g. mv config.sh config.sh.old. Then rerun Configure
1440with the options you want to use.
1441
1ec51d55
CS
1442This is a common source of problems. If you change from cc to
1443gcc, you should almost always remove your old config.sh.
8e07c86e 1444
c3edaffb 1445=item Propagating your changes to config.sh
8e07c86e 1446
1ec51d55
CS
1447If you make any changes to config.sh, you should propagate
1448them to all the .SH files by running
1449
1450 sh Configure -S
1451
1452You will then have to rebuild by running
9d67150a
PP
1453
1454 make depend
1455 make
8e07c86e 1456
48370efc
JH
1457=item config.over and config.arch
1458
1459You can also supply a shell script config.over to over-ride
1460Configure's guesses. It will get loaded up at the very end, just
1461before config.sh is created. You have to be careful with this,
1462however, as Configure does no checking that your changes make sense.
1463This file is usually good for site-specific customizations.
1464
1465There is also another file that, if it exists, is loaded before the
1466config.over, called config.arch. This file is intended to be per
1467architecture, not per site, and usually it's the architecture-specific
1468hints file that creates the config.arch.
8e07c86e
AD
1469
1470=item config.h
1471
1ec51d55
CS
1472Many of the system dependencies are contained in config.h.
1473Configure builds config.h by running the config_h.SH script.
1474The values for the variables are taken from config.sh.
8e07c86e 1475
1ec51d55
CS
1476If there are any problems, you can edit config.h directly. Beware,
1477though, that the next time you run Configure, your changes will be
8e07c86e
AD
1478lost.
1479
1480=item cflags
1481
1482If you have any additional changes to make to the C compiler command
1ec51d55
CS
1483line, they can be made in cflags.SH. For instance, to turn off the
1484optimizer on toke.c, find the line in the switch structure for
1485toke.c and put the command optimize='-g' before the ;; . You
1486can also edit cflags directly, but beware that your changes will be
1487lost the next time you run Configure.
8e07c86e 1488
f5b3b617
AD
1489To explore various ways of changing ccflags from within a hint file,
1490see the file hints/README.hints.
1491
1492To change the C flags for all the files, edit config.sh and change either
1493$ccflags or $optimize, and then re-run
1ec51d55
CS
1494
1495 sh Configure -S
1496 make depend
8e07c86e 1497
aa689395 1498=item No sh
8e07c86e 1499
c42e3e15
GS
1500If you don't have sh, you'll have to copy the sample file
1501Porting/config.sh to config.sh and edit your config.sh to reflect your
1502system's peculiarities. See Porting/pumpkin.pod for more information.
8e07c86e
AD
1503You'll probably also have to extensively modify the extension building
1504mechanism.
1505
d6baa268
JH
1506=item Digital UNIX/Tru64 UNIX and BIN_SH
1507
1508In Digital UNIX/Tru64 UNIX, Configure might abort with
1509
1510Build a threading Perl? [n]
1511Configure[2437]: Syntax error at line 1 : `config.sh' is not expected.
1512
1513This indicates that Configure is being run with a broken Korn shell
1514(even though you think you are using a Bourne shell by using
1515"sh Configure" or "./Configure"). The Korn shell bug has been reported
1516to Compaq as of February 1999 but in the meanwhile, the reason ksh is
1517being used is that you have the environment variable BIN_SH set to
1518'xpg4'. This causes /bin/sh to delegate its duties to /bin/posix/sh
1519(a ksh). Unset the environment variable and rerun Configure.
1520
1521=item HP-UX 11, pthreads, and libgdbm
1522
1523If you are running Configure with -Dusethreads in HP-UX 11, be warned
1524that POSIX threads and libgdbm (the GNU dbm library) compiled before
1525HP-UX 11 do not mix. This will cause a basic test run by Configure to
1526fail
1527
1528Pthread internal error: message: __libc_reinit() failed, file: ../pthreads/pthread.c, line: 1096
1529Return Pointer is 0xc082bf33
1530sh: 5345 Quit(coredump)
1531
1532and Configure will give up. The cure is to recompile and install
1533libgdbm under HP-UX 11.
1534
c3edaffb
PP
1535=item Porting information
1536
e6f03d26 1537Specific information for the OS/2, Plan 9, VMS and Win32 ports is in the
1ec51d55
CS
1538corresponding README files and subdirectories. Additional information,
1539including a glossary of all those config.sh variables, is in the Porting
c42e3e15 1540subdirectory. Especially Porting/Glossary should come in handy.
c3edaffb 1541
7f678428 1542Ports for other systems may also be available. You should check out
468f45d5 1543http://www.cpan.org/ports for current information on ports to
7f678428
PP
1544various other operating systems.
1545
491517e0
JA
1546If you plan to port Perl to a new architecture study carefully the
1547section titled "Philosophical Issues in Patching and Porting Perl"
1548in the file Porting/pumpkin.pod and the file Porting/patching.pod.
1549Study also how other non-UNIX ports have solved problems.
1550
8e07c86e
AD
1551=back
1552
fadf0ef5
JH
1553=head1 Adding extra modules to the build
1554
1555You can specify extra modules or module bundles to be fetched from the
1556CPAN and installed as part of the Perl build. Either use the -Dextras=...
1557command line parameter to Configure, for example like this:
1558
1559 Configure -Dextras="Compress::Zlib Bundle::LWP DBI"
1560
1561or answer first 'y' to the question 'Install any extra modules?' and
1562then answer "Compress::Zlib Bundle::LWP DBI" to the 'Extras?' question.
1563The module or the bundle names are as for the CPAN module 'install' command.
a522f097
AD
1564This will only work if those modules are to be built as dynamic
1565extensions. If you wish to include those extra modules as static
1566extensions, see L<"Extensions"> above.
fadf0ef5
JH
1567
1568Notice that because the CPAN module will be used to fetch the extra
1569modules, you will need access to the CPAN, either via the Internet,
1570or via a local copy such as a CD-ROM or a local CPAN mirror. If you
1571do not, using the extra modules option will die horribly.
1572
1573Also notice that you yourself are responsible for satisfying any extra
1574dependencies such as external headers or libraries BEFORE trying the build.
1575For example: you will need to have the zlib.h header and the libz
1576library installed for the Compress::Zlib, or the Foo database specific
1577headers and libraries installed for the DBD::Foo module. The Configure
1578process or the Perl build process will not help you with these.
1579
03739d21
JH
1580=head1 suidperl
1581
c80c8d62 1582suidperl is an optional component, which is built or installed by default.
03739d21
JH
1583From perlfaq1:
1584
1585 On some systems, setuid and setgid scripts (scripts written
1586 in the C shell, Bourne shell, or Perl, for example, with the
1587 set user or group ID permissions enabled) are insecure due to
1588 a race condition in the kernel. For those systems, Perl versions
1589 5 and 4 attempt to work around this vulnerability with an optional
1590 component, a special program named suidperl, also known as sperl.
1591 This program attempts to emulate the set-user-ID and set-group-ID
1592 features of the kernel.
1593
1594Because of the buggy history of suidperl, and the difficulty
1595of properly security auditing as large and complex piece of
1596software as Perl, we cannot recommend using suidperl and the feature
1597should be considered deprecated.
1598Instead use for example 'sudo': http://www.courtesan.com/sudo/
1599
8e07c86e
AD
1600=head1 make depend
1601
bfb7748a
AD
1602This will look for all the includes. The output is stored in makefile.
1603The only difference between Makefile and makefile is the dependencies at
1604the bottom of makefile. If you have to make any changes, you should edit
1605makefile, not Makefile since the Unix make command reads makefile first.
1606(On non-Unix systems, the output may be stored in a different file.
1607Check the value of $firstmakefile in your config.sh if in doubt.)
8e07c86e
AD
1608
1609Configure will offer to do this step for you, so it isn't listed
1610explicitly above.
1611
1612=head1 make
1613
1614This will attempt to make perl in the current directory.
1615
8d410bc4
YST
1616=head2 Expected errors
1617
1618These errors are normal, and can be ignored:
1619
1620 ...
1621 make: [extra.pods] Error 1 (ignored)
1622 ...
1623 make: [extras.make] Error 1 (ignored)
1624
8d74ce1c
AD
1625=head2 What if it doesn't work?
1626
8e07c86e 1627If you can't compile successfully, try some of the following ideas.
7f678428 1628If none of them help, and careful reading of the error message and
8d74ce1c 1629the relevant manual pages on your system doesn't help,
40dd8381 1630then see L<"Reporting Problems"> above.
8e07c86e
AD
1631
1632=over 4
1633
1ec51d55 1634=item hints
8e07c86e
AD
1635
1636If you used a hint file, try reading the comments in the hint file
1637for further tips and information.
1638
1ec51d55 1639=item extensions
8e07c86e 1640
1ec51d55 1641If you can successfully build miniperl, but the process crashes
c3edaffb
PP
1642during the building of extensions, you should run
1643
3a6175e1 1644 make minitest
c3edaffb
PP
1645
1646to test your version of miniperl.
1647
e57fd563
PP
1648=item locale
1649
bfb7748a
AD
1650If you have any locale-related environment variables set, try unsetting
1651them. I have some reports that some versions of IRIX hang while
1652running B<./miniperl configpm> with locales other than the C locale.
1653See the discussion under L<"make test"> below about locales and the
1654whole L<"Locale problems"> section in the file pod/perllocale.pod.
3e6e419a
JH
1655The latter is especially useful if you see something like this
1656
1657 perl: warning: Setting locale failed.
1658 perl: warning: Please check that your locale settings:
1659 LC_ALL = "En_US",
1660 LANG = (unset)
1661 are supported and installed on your system.
1662 perl: warning: Falling back to the standard locale ("C").
1663
1664at Perl startup.
e57fd563 1665
7f678428 1666=item varargs
c3edaffb
PP
1667
1668If you get varargs problems with gcc, be sure that gcc is installed
bfb7748a
AD
1669correctly and that you are not passing -I/usr/include to gcc. When using
1670gcc, you should probably have i_stdarg='define' and i_varargs='undef'
1671in config.sh. The problem is usually solved by running fixincludes
1672correctly. If you do change config.sh, don't forget to propagate
1673your changes (see L<"Propagating your changes to config.sh"> below).
7f678428 1674See also the L<"vsprintf"> item below.
c3edaffb 1675
bfb7748a 1676=item util.c
c3edaffb
PP
1677
1678If you get error messages such as the following (the exact line
bfb7748a 1679numbers and function name may vary in different versions of perl):
c3edaffb 1680
bfb7748a
AD
1681 util.c: In function `Perl_form':
1682 util.c:1107: number of arguments doesn't match prototype
1683 proto.h:125: prototype declaration
c3edaffb
PP
1684
1685it might well be a symptom of the gcc "varargs problem". See the
7f678428 1686previous L<"varargs"> item.
c3edaffb 1687
1ec51d55 1688=item LD_LIBRARY_PATH
c3edaffb
PP
1689
1690If you run into dynamic loading problems, check your setting of
aa689395
PP
1691the LD_LIBRARY_PATH environment variable. If you're creating a static
1692Perl library (libperl.a rather than libperl.so) it should build
c3edaffb
PP
1693fine with LD_LIBRARY_PATH unset, though that may depend on details
1694of your local set-up.
1695
aa689395 1696=item nm extraction
c3edaffb
PP
1697
1698If Configure seems to be having trouble finding library functions,
1699try not using nm extraction. You can do this from the command line
1700with
1701
1702 sh Configure -Uusenm
1703
1704or by answering the nm extraction question interactively.
1ec51d55 1705If you have previously run Configure, you should not reuse your old
c3edaffb
PP
1706config.sh.
1707
bfb7748a
AD
1708=item umask not found
1709
1710If the build processes encounters errors relating to umask(), the problem
1711is probably that Configure couldn't find your umask() system call.
1712Check your config.sh. You should have d_umask='define'. If you don't,
1713this is probably the L<"nm extraction"> problem discussed above. Also,
1714try reading the hints file for your system for further information.
1715
7f678428 1716=item vsprintf
c3edaffb
PP
1717
1718If you run into problems with vsprintf in compiling util.c, the
1719problem is probably that Configure failed to detect your system's
1720version of vsprintf(). Check whether your system has vprintf().
1721(Virtually all modern Unix systems do.) Then, check the variable
1722d_vprintf in config.sh. If your system has vprintf, it should be:
1723
1724 d_vprintf='define'
1725
1726If Configure guessed wrong, it is likely that Configure guessed wrong
bfb7748a
AD
1727on a number of other common functions too. This is probably
1728the L<"nm extraction"> problem discussed above.
c3edaffb 1729
3fe9a6f1
PP
1730=item do_aspawn
1731
1732If you run into problems relating to do_aspawn or do_spawn, the
1733problem is probably that Configure failed to detect your system's
bfb7748a
AD
1734fork() function. Follow the procedure in the previous item
1735on L<"nm extraction">.
3fe9a6f1 1736
84902520
TB
1737=item __inet_* errors
1738
1739If you receive unresolved symbol errors during Perl build and/or test
1740referring to __inet_* symbols, check to see whether BIND 8.1 is
1741installed. It installs a /usr/local/include/arpa/inet.h that refers to
1742these symbols. Versions of BIND later than 8.1 do not install inet.h
1743in that location and avoid the errors. You should probably update to a
6d240721
JH
1744newer version of BIND (and remove the files the old one left behind).
1745If you can't, you can either link with the updated resolver library provided
1746with BIND 8.1 or rename /usr/local/bin/arpa/inet.h during the Perl build and
1747test process to avoid the problem.
1748
1749=item *_r() prototype NOT found
1750
1751On a related note, if you see a bunch of complaints like the above about
1752reentrant functions - specifically networking-related ones - being present
1753but without prototypes available, check to see if BIND 8.1 (or possibly
1754other BIND 8 versions) is (or has been) installed. They install
1755header files such as netdb.h into places such as /usr/local/include (or into
1756another directory as specified at build/install time), at least optionally.
f1300be0 1757Remove them or put them in someplace that isn't in the C preprocessor's
6d240721
JH
1758header file include search path (determined by -I options plus defaults,
1759normally /usr/include).
84902520 1760
d6baa268
JH
1761=item #error "No DATAMODEL_NATIVE specified"
1762
1763This is a common error when trying to build perl on Solaris 2.6 with a
1764gcc installation from Solaris 2.5 or 2.5.1. The Solaris header files
1765changed, so you need to update your gcc installation. You can either
1766rerun the fixincludes script from gcc or take the opportunity to
1767update your gcc installation.
1768
aa689395 1769=item Optimizer
c3edaffb 1770
9d67150a 1771If you can't compile successfully, try turning off your compiler's
aa689395 1772optimizer. Edit config.sh and change the line
9d67150a
PP
1773
1774 optimize='-O'
1775
bfb7748a 1776to
9d67150a
PP
1777
1778 optimize=' '
1779
1780then propagate your changes with B<sh Configure -S> and rebuild
1781with B<make depend; make>.
1782
9d67150a
PP
1783=item Missing functions
1784
1785If you have missing routines, you probably need to add some library or
1786other, or you need to undefine some feature that Configure thought was
1787there but is defective or incomplete. Look through config.h for
bfb7748a
AD
1788likely suspects. If Configure guessed wrong on a number of functions,
1789you might have the L<"nm extraction"> problem discussed above.
8e07c86e 1790
1ec51d55 1791=item toke.c
8e07c86e 1792
1ec51d55
CS
1793Some compilers will not compile or optimize the larger files (such as
1794toke.c) without some extra switches to use larger jump offsets or
1795allocate larger internal tables. You can customize the switches for
1796each file in cflags. It's okay to insert rules for specific files into
1797makefile since a default rule only takes effect in the absence of a
8e07c86e
AD
1798specific rule.
1799
7f678428 1800=item Missing dbmclose
8e07c86e 1801
c3edaffb
PP
1802SCO prior to 3.2.4 may be missing dbmclose(). An upgrade to 3.2.4
1803that includes libdbm.nfs (which includes dbmclose()) may be available.
8e07c86e 1804
f3d9a6ba 1805=item Note (probably harmless): No library found for -lsomething
7f678428
PP
1806
1807If you see such a message during the building of an extension, but
1808the extension passes its tests anyway (see L<"make test"> below),
1809then don't worry about the warning message. The extension
1810Makefile.PL goes looking for various libraries needed on various
aa689395 1811systems; few systems will need all the possible libraries listed.
7f678428
PP
1812For example, a system may have -lcposix or -lposix, but it's
1813unlikely to have both, so most users will see warnings for the one
f3d9a6ba
CS
1814they don't have. The phrase 'probably harmless' is intended to
1815reassure you that nothing unusual is happening, and the build
1816process is continuing.
7f678428
PP
1817
1818On the other hand, if you are building GDBM_File and you get the
1819message
1820
f3d9a6ba 1821 Note (probably harmless): No library found for -lgdbm
7f678428
PP
1822
1823then it's likely you're going to run into trouble somewhere along
1824the line, since it's hard to see how you can use the GDBM_File
1825extension without the -lgdbm library.
1826
1827It is true that, in principle, Configure could have figured all of
1828this out, but Configure and the extension building process are not
1829quite that tightly coordinated.
1830
aa689395
PP
1831=item sh: ar: not found
1832
1833This is a message from your shell telling you that the command 'ar'
1834was not found. You need to check your PATH environment variable to
1835make sure that it includes the directory with the 'ar' command. This
1ec51d55 1836is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin
aa689395
PP
1837directory.
1838
1839=item db-recno failure on tests 51, 53 and 55
1840
1841Old versions of the DB library (including the DB library which comes
1842with FreeBSD 2.1) had broken handling of recno databases with modified
1843bval settings. Upgrade your DB library or OS.
1844
6087ac44
JH
1845=item Bad arg length for semctl, is XX, should be ZZZ
1846
11906ba0 1847If you get this error message from the ext/IPC/SysV/t/sem test, your System
6087ac44
JH
1848V IPC may be broken. The XX typically is 20, and that is what ZZZ
1849also should be. Consider upgrading your OS, or reconfiguring your OS
1850to include the System V semaphores.
1851
11906ba0 1852=item ext/IPC/SysV/t/sem........semget: No space left on device
220f3621
GS
1853
1854Either your account or the whole system has run out of semaphores. Or
1855both. Either list the semaphores with "ipcs" and remove the unneeded
1856ones (which ones these are depends on your system and applications)
1857with "ipcrm -s SEMAPHORE_ID_HERE" or configure more semaphores to your
1858system.
1859
d6baa268
JH
1860=item GNU binutils
1861
1862If you mix GNU binutils (nm, ld, ar) with equivalent vendor-supplied
1863tools you may be in for some trouble. For example creating archives
1864with an old GNU 'ar' and then using a new current vendor-supplied 'ld'
1865may lead into linking problems. Either recompile your GNU binutils
1866under your current operating system release, or modify your PATH not
1867to include the GNU utils before running Configure, or specify the
1868vendor-supplied utilities explicitly to Configure, for example by
1869Configure -Dar=/bin/ar.
1870
16dc217a
GS
1871=item THIS PACKAGE SEEMS TO BE INCOMPLETE
1872
1873The F<Configure> program has not been able to find all the files which
1874make up the complete Perl distribution. You may have a damaged source
1875archive file (in which case you may also have seen messages such as
1876C<gzip: stdin: unexpected end of file> and C<tar: Unexpected EOF on
1877archive file>), or you may have obtained a structurally-sound but
1878incomplete archive. In either case, try downloading again from the
1879official site named at the start of this document. If you do find
1880that any site is carrying a corrupted or incomplete source code
1881archive, please report it to the site's maintainer.
1882
16dc217a
GS
1883=item invalid token: ##
1884
1885You are using a non-ANSI-compliant C compiler. See L<WARNING: This
a522f097 1886version requires a compiler that supports ANSI C.>
16dc217a 1887
1ec51d55 1888=item Miscellaneous
8e07c86e
AD
1889
1890Some additional things that have been reported for either perl4 or perl5:
1891
1892Genix may need to use libc rather than libc_s, or #undef VARARGS.
1893
1894NCR Tower 32 (OS 2.01.01) may need -W2,-Sl,2000 and #undef MKDIR.
1895
9ede5bc8 1896UTS may need one or more of -K or -g, and undef LSTAT.
8e07c86e 1897
11906ba0 1898FreeBSD can fail the ext/IPC/SysV/t/sem.t test if SysV IPC has not been
5cda700b 1899configured in the kernel. Perl tries to detect this, though, and
220f3621 1900you will get a message telling what to do.
6087ac44 1901
d6baa268
JH
1902HP-UX 11 Y2K patch "Y2K-1100 B.11.00.B0125 HP-UX Core OS Year 2000
1903Patch Bundle" has been reported to break the io/fs test #18 which
1904tests whether utime() can change timestamps. The Y2K patch seems to
1905break utime() so that over NFS the timestamps do not get changed
1906(on local filesystems utime() still works).
1907
6c8d78fb
HS
1908Building Perl on a system that has also BIND (headers and libraries)
1909installed may run into troubles because BIND installs its own netdb.h
1910and socket.h, which may not agree with the operating system's ideas of
1911the same files. Similarly, including -lbind may conflict with libc's
1912view of the world. You may have to tweak -Dlocincpth and -Dloclibpth
1913to avoid the BIND.
1914
8e07c86e
AD
1915=back
1916
58a21a9b
JH
1917=head2 Cross-compilation
1918
1919Starting from Perl 5.8 Perl has the beginnings of cross-compilation
1920support. What is known to work is running Configure in a
1921cross-compilation environment and building the miniperl executable.
65090350 1922What is known not to work is building the perl executable because
58a21a9b
JH
1923that would require building extensions: Dynaloader statically and
1924File::Glob dynamically, for extensions one needs MakeMaker and
1925MakeMaker is not yet cross-compilation aware, and neither is
1926the main Makefile.
1927
93bc48fa
JH
1928Since the functionality is so lacking, it must be considered
1929highly experimental. It is so experimental that it is not even
c80c8d62 1930mentioned during an interactive Configure session, a direct command
93bc48fa
JH
1931line invocation (detailed shortly) is required to access the
1932functionality.
1933
58a21a9b 1934 NOTE: Perl is routinely built using cross-compilation
6a809565
JH
1935 in the EPOC environment, in the WinCE, and in the OpenZaurus
1936 project, but all those use something slightly different setup
1937 than what described here. For the WinCE setup, read the
1938 wince/README.compile. For the OpenZaurus setup, read the
1939 Cross/README.
1940
1941The one environment where this cross-compilation setup has
1942successfully been used as of this writing is the Compaq iPAQ running
1943ARM Linux. The build host was Intel Linux, the networking setup was
1944PPP + SSH. The exact setup details are beyond the scope of this
1945document, see http://www.handhelds.org/ for more information.
58a21a9b
JH
1946
1947To run Configure in cross-compilation mode the basic switch is
1948C<-Dusecrosscompile>.
1949
1950 sh ./Configure -des -Dusecrosscompile -D...
1951
1952This will make the cpp symbol USE_CROSS_COMPILE and the %Config
1953symbol C<usecrosscompile> available.
1954
1955During the Configure and build, certain helper scripts will be created
1956into the Cross/ subdirectory. The scripts are used to execute a
1957cross-compiled executable, and to transfer files to and from the
1958target host. The execution scripts are named F<run-*> and the
1959transfer scripts F<to-*> and F<from-*>. The part after the dash is
1960the method to use for remote execution and transfer: by default the
1961methods are B<ssh> and B<scp>, thus making the scripts F<run-ssh>,
1962F<to-scp>, and F<from-scp>.
1963
1964To configure the scripts for a target host and a directory (in which
1965the execution will happen and which is to and from where the transfer
1966happens), supply Configure with
1967
1968 -Dtargethost=so.me.ho.st -Dtargetdir=/tar/get/dir
1969
1970The targethost is what e.g. ssh will use as the hostname, the targetdir
93bc48fa
JH
1971must exist (the scripts won't create it), the targetdir defaults to /tmp.
1972You can also specify a username to use for ssh/rsh logins
58a21a9b
JH
1973
1974 -Dtargetuser=luser
1975
1976but in case you don't, "root" will be used.
1977
93bc48fa
JH
1978Because this is a cross-compilation effort, you will also need to specify
1979which target environment and which compilation environment to use.
1980This includes the compiler, the header files, and the libraries.
1981In the below we use the usual settings for the iPAQ cross-compilation
1982environment:
58a21a9b
JH
1983
1984 -Dtargetarch=arm-linux
1985 -Dcc=arm-linux-gcc
1986 -Dusrinc=/skiff/local/arm-linux/include
1987 -Dincpth=/skiff/local/arm-linux/include
1988 -Dlibpth=/skiff/local/arm-linux/lib
1989
1990If the name of the C<cc> has the usual GNU C semantics for cross
1991compilers, that is, CPU-OS-gcc, the names of the C<ar>, C<nm>, and
1992C<ranlib> will also be automatically chosen to be CPU-OS-ar and so on.
93bc48fa
JH
1993(The C<ld> requires more thought and will be chosen later by Configure
1994as appropriate.) Also, in this case the incpth, libpth, and usrinc
1995will be guessed by Configure (unless explicitly set to something else,
1996in which case Configure's guesses with be appended).
58a21a9b
JH
1997
1998In addition to the default execution/transfer methods you can also
1999choose B<rsh> for execution, and B<rcp> or B<cp> for transfer,
2000for example:
2001
2002 -Dtargetrun=rsh -Dtargetto=rcp -Dtargetfrom=cp
2003
2004Putting it all together:
2005
2006 sh ./Configure -des -Dusecrosscompile \
93bc48fa
JH
2007 -Dtargethost=so.me.ho.st \
2008 -Dtargetdir=/tar/get/dir \
58a21a9b
JH
2009 -Dtargetuser=root \
2010 -Dtargetarch=arm-linux \
2011 -Dcc=arm-linux-gcc \
2012 -Dusrinc=/skiff/local/arm-linux/include \
2013 -Dincpth=/skiff/local/arm-linux/include \
2014 -Dlibpth=/skiff/local/arm-linux/lib \
2015 -D...
2016
93bc48fa
JH
2017or if you are happy with the defaults
2018
2019 sh ./Configure -des -Dusecrosscompile \
2020 -Dtargethost=so.me.ho.st \
2021 -Dcc=arm-linux-gcc \
2022 -D...
2023
8e07c86e
AD
2024=head1 make test
2025
d6baa268
JH
2026This will run the regression tests on the perl you just made. If
2027'make test' doesn't say "All tests successful" then something went
2028wrong. See the file t/README in the t subdirectory.
84902520 2029
84902520 2030Note that you can't run the tests in background if this disables
fb73857a
PP
2031opening of /dev/tty. You can use 'make test-notty' in that case but
2032a few tty tests will be skipped.
c3edaffb 2033
c4f23d77
AD
2034=head2 What if make test doesn't work?
2035
1ec51d55
CS
2036If make test bombs out, just cd to the t directory and run ./TEST
2037by hand to see if it makes any difference. If individual tests
c3edaffb 2038bomb, you can run them by hand, e.g.,
8e07c86e
AD
2039
2040 ./perl op/groups.t
2041
aa689395 2042Another way to get more detailed information about failed tests and
1ec51d55 2043individual subtests is to cd to the t directory and run
aa689395
PP
2044
2045 ./perl harness
2046
fb73857a 2047(this assumes that most basic tests succeed, since harness uses
10c7e831
JH
2048complicated constructs). For extension and library tests you
2049need a little bit more: you need to setup your environment variable
2050PERL_CORE to a true value (like "1"), and you need to supply the
2051right Perl library path:
2052
2053 setenv PERL_CORE 1
2054 ./perl -I../lib ../ext/Socket/Socket.t
2055 ./perl -I../lib ../lib/less.t
aa689395 2056
5cda700b 2057(For csh-like shells on UNIX; adjust appropriately for other platforms.)
fb73857a 2058You should also read the individual tests to see if there are any helpful
10c7e831
JH
2059comments that apply to your system. You may also need to setup your
2060shared library path if you get errors like:
2061
2062 /sbin/loader: Fatal Error: cannot map libperl.so
2063
2064See L</"Building a shared Perl library"> earlier in this document.
c3edaffb 2065
c4f23d77
AD
2066=over 4
2067
2068=item locale
2069
1ec51d55 2070Note: One possible reason for errors is that some external programs
c07a80fd 2071may be broken due to the combination of your environment and the way
3fe9a6f1 2072B<make test> exercises them. For example, this may happen if you have
1ec51d55
CS
2073one or more of these environment variables set: LC_ALL LC_CTYPE
2074LC_COLLATE LANG. In some versions of UNIX, the non-English locales
e57fd563
PP
2075are known to cause programs to exhibit mysterious errors.
2076
2077If you have any of the above environment variables set, please try
aa689395
PP
2078
2079 setenv LC_ALL C
2080
2081(for C shell) or
2082
2083 LC_ALL=C;export LC_ALL
2084
1ec51d55
CS
2085for Bourne or Korn shell) from the command line and then retry
2086make test. If the tests then succeed, you may have a broken program that
aa689395 2087is confusing the testing. Please run the troublesome test by hand as
e57fd563 2088shown above and see whether you can locate the program. Look for
1ec51d55
CS
2089things like: exec, `backquoted command`, system, open("|...") or
2090open("...|"). All these mean that Perl is trying to run some
e57fd563 2091external program.
eed2e782 2092
0740bb5b
AD
2093=item Timing problems
2094
c29923ff
JH
2095Several tests in the test suite check timing functions, such as
2096sleep(), and see if they return in a reasonable amount of time.
9341413f
JH
2097If your system is quite busy and doesn't respond quickly enough,
2098these tests might fail. If possible, try running the tests again
2099with the system under a lighter load. These timing-sensitive
2100and load-sensitive tests include F<t/op/alarm.t>,
2101F<ext/Time/HiRes/HiRes.t>, F<lib/Benchmark.t>,
2102F<lib/Memoize/t/expmod_t.t>, and F<lib/Memoize/t/speed.t>.
0740bb5b 2103
c4f23d77
AD
2104=item Out of memory
2105
2106On some systems, particularly those with smaller amounts of RAM, some
2107of the tests in t/op/pat.t may fail with an "Out of memory" message.
7970f296
GS
2108For example, on my SparcStation IPC with 12 MB of RAM, in perl5.5.670,
2109test 85 will fail if run under either t/TEST or t/harness.
c4f23d77
AD
2110
2111Try stopping other jobs on the system and then running the test by itself:
2112
2113 cd t; ./perl op/pat.t
2114
2115to see if you have any better luck. If your perl still fails this
2116test, it does not necessarily mean you have a broken perl. This test
2117tries to exercise the regular expression subsystem quite thoroughly,
2118and may well be far more demanding than your normal usage.
2119
4f76e5ba
AD
2120=item Failures from lib/File/Temp/t/security saying "system possibly insecure"
2121
2122First, such warnings are not necessarily serious or indicative of a
2123real security threat. That being said, they bear investigating.
2124
2125Note that each of the tests is run twice. The first time is in the
2126directory returned by File::Spec->tmpdir() (often /tmp on Unix
2127systems), and the second time in the directory from which the test was
2128run (usually the 't' directory, if the test was run as part of 'make
2129test').
2130
2131The tests may fail for the following reasons:
2132
2133(1) If the directory the tests are being run in is owned by somebody
2134other than the user running the tests, or by root (uid 0).
2135
2136This failure can happen if the Perl source code distribution is
2137unpacked in such a way that the user ids in the distribution package
2138are used as-is. Some tar programs do this.
2139
2140(2) If the directory the tests are being run in is writable by group or
2141by others, and there is no sticky bit set for the directory. (With
2142UNIX/POSIX semantics, write access to a directory means the right to
2143add or remove files in that directory. The 'sticky bit' is a feature
2144used in some UNIXes to give extra protection to files: if the bit is
2145set for a directory, no one but the owner (or root) can remove that
2146file even if the permissions would otherwise allow file removal by
2147others.)
2148
2149This failure may or may not be a real problem: it depends on the
2150permissions policy used on this particular system. This failure can
2151also happen if the system either doesn't support the sticky bit (this
2152is the case with many non-UNIX platforms: in principle File::Temp
2153should know about these platforms and skip the tests), or if the system
2154supports the sticky bit but for some reason or reasons it is not being
2155used. This is, for example, the case with HP-UX: as of HP-UX release
215611.00, the sticky bit is very much supported, but HP-UX doesn't use it
2157on its /tmp directory as shipped. Also, as with the permissions, some
2158local policy might dictate that the stickiness is not used.
781948c1 2159
b2b23189
JH
2160(3) If the system supports the POSIX 'chown giveaway' feature and if
2161any of the parent directories of the temporary file back to the root
2162directory are 'unsafe', using the definitions given above in (1) and
4f76e5ba
AD
2163(2). For Unix systems, this is usually not an issue if you are
2164building on a local disk. See the documentation for the File::Temp
2165module for more information about 'chown giveaway'.
781948c1
JH
2166
2167See the documentation for the File::Temp module for more information
4f76e5ba 2168about the various security aspects of temporary files.
781948c1 2169
c4f23d77
AD
2170=back
2171
8e07c86e
AD
2172=head1 make install
2173
2174This will put perl into the public directory you specified to
1ec51d55 2175Configure; by default this is /usr/local/bin. It will also try
8e07c86e 2176to put the man pages in a reasonable place. It will not nroff the man
aa689395 2177pages, however. You may need to be root to run B<make install>. If you
8e07c86e
AD
2178are not root, you must own the directories in question and you should
2179ignore any messages about chown not working.
2180
dd64f1c3
AD
2181=head2 Installing perl under different names
2182
2183If you want to install perl under a name other than "perl" (for example,
2184when installing perl with special features enabled, such as debugging),
2185indicate the alternate name on the "make install" line, such as:
2186
2187 make install PERLNAME=myperl
2188
beb13193
RS
2189You can separately change the base used for versioned names (like
2190"perl5.005") by setting PERLNAME_VERBASE, like
2191
2192 make install PERLNAME=perl5 PERLNAME_VERBASE=perl
2193
5cda700b
AD
2194This can be useful if you have to install perl as "perl5" (e.g. to
2195avoid conflicts with an ancient version in /usr/bin supplied by your vendor).
2196Without this the versioned binary would be called "perl55.005".
beb13193 2197
dd64f1c3
AD
2198=head2 Installed files
2199
8e07c86e
AD
2200If you want to see exactly what will happen without installing
2201anything, you can run
4633a7c4 2202
8e07c86e
AD
2203 ./perl installperl -n
2204 ./perl installman -n
2205
1ec51d55 2206make install will install the following:
8e07c86e 2207
d56c5707
JH
2208 binaries
2209
8e07c86e
AD
2210 perl,
2211 perl5.nnn where nnn is the current release number. This
2212 will be a link to perl.
2213 suidperl,
2214 sperl5.nnn If you requested setuid emulation.
2215 a2p awk-to-perl translator
d56c5707
JH
2216
2217 scripts
2218
8e07c86e
AD
2219 cppstdin This is used by perl -P, if your cc -E can't
2220 read from stdin.
2221 c2ph, pstruct Scripts for handling C structures in header files.
2222 s2p sed-to-perl translator
2223 find2perl find-to-perl translator
aa689395 2224 h2ph Extract constants and simple macros from C headers
8e07c86e 2225 h2xs Converts C .h header files to Perl extensions.
24b3df7f 2226 perlbug Tool to report bugs in Perl.
8e07c86e 2227 perldoc Tool to read perl's pod documentation.
aa689395 2228 pl2pm Convert Perl 4 .pl files to Perl 5 .pm modules
8e07c86e 2229 pod2html, Converters from perl's pod documentation format
aa689395 2230 pod2latex, to other useful formats.
d56c5707
JH
2231 pod2man,
2232 pod2text,
2233 pod2checker,
2234 pod2select,
2235 pod2usage
aa689395 2236 splain Describe Perl warnings and errors
95667ae4 2237 dprofpp Perl code profile post-processor
8e07c86e 2238
d56c5707
JH
2239 library files
2240
2241 in $privlib and $archlib specified to
8e07c86e 2242 Configure, usually under /usr/local/lib/perl5/.
d56c5707
JH
2243
2244 documentation
2245
d6baa268
JH
2246 man pages in $man1dir, usually /usr/local/man/man1.
2247 module man
2248 pages in $man3dir, usually /usr/local/man/man3.
8e07c86e
AD
2249 pod/*.pod in $privlib/pod/.
2250
d6baa268
JH
2251Installperl will also create the directories listed above
2252in L<"Installation Directories">.
4633a7c4 2253
d56c5707 2254Perl's *.h header files and the libperl library are also installed
d6baa268 2255under $archlib so that any user may later build new modules, run the
56c6f531
JH
2256optional Perl compiler, or embed the perl interpreter into another
2257program even if the Perl source is no longer available.
8e07c86e 2258
d56c5707
JH
2259Sometimes you only want to install the version-specific parts of the perl
2260installation. For example, you may wish to install a newer version of
2261perl alongside an already installed production version of perl without
2262disabling installation of new modules for the production version.
2263To only install the version-specific parts of the perl installation, run
2264
2265 Configure -Dversiononly
2266
2267or answer 'y' to the appropriate Configure prompt. Alternatively,
2268you can just manually run
2269
2270 ./perl installperl -v
2271
2272and skip installman altogether.
2273See also L<"Maintaining completely separate versions"> for another
2274approach.
2275
aa689395 2276=head1 Coexistence with earlier versions of perl5
4633a7c4 2277
9a664500 2278Perl 5.9 is not binary compatible with earlier versions of Perl.
cc65bb49 2279In other words, you will have to recompile your XS modules.
14eee2f1 2280
693762b4 2281In general, you can usually safely upgrade from one version of Perl (e.g.
9a664500 22825.8.0) to another similar version (e.g. 5.8.2) without re-compiling
693762b4
AD
2283all of your add-on extensions. You can also safely leave the old version
2284around in case the new version causes you problems for some reason.
2285For example, if you want to be sure that your script continues to run
9a664500 2286with 5.8.2, simply replace the '#!/usr/local/bin/perl' line at the
693762b4 2287top of the script with the particular version you want to run, e.g.
9a664500 2288#!/usr/local/bin/perl5.8.2.
693762b4 2289
e655887d
CB
2290Usually, most extensions will probably not need to be recompiled to
2291use with a newer version of Perl (the Perl 5.6 to Perl 5.8 transition
2292being an exception). Here is how it is supposed to work. (These
2293examples assume you accept all the Configure defaults.)
693762b4 2294
d6baa268
JH
2295Suppose you already have version 5.005_03 installed. The directories
2296searched by 5.005_03 are
2297
2298 /usr/local/lib/perl5/5.00503/$archname
2299 /usr/local/lib/perl5/5.00503
2300 /usr/local/lib/perl5/site_perl/5.005/$archname
2301 /usr/local/lib/perl5/site_perl/5.005
2302
0a08c020
GS
2303Beginning with 5.6.0 the version number in the site libraries are
2304fully versioned. Now, suppose you install version 5.6.0. The directories
2305searched by version 5.6.0 will be
d6baa268 2306
0a08c020
GS
2307 /usr/local/lib/perl5/5.6.0/$archname
2308 /usr/local/lib/perl5/5.6.0
2309 /usr/local/lib/perl5/site_perl/5.6.0/$archname
2310 /usr/local/lib/perl5/site_perl/5.6.0
d6baa268
JH
2311
2312 /usr/local/lib/perl5/site_perl/5.005/$archname
2313 /usr/local/lib/perl5/site_perl/5.005
c42e3e15 2314 /usr/local/lib/perl5/site_perl/
bfb7748a 2315
c42e3e15 2316Notice the last three entries -- Perl understands the default structure
d6baa268
JH
2317of the $sitelib directories and will look back in older, compatible
2318directories. This way, modules installed under 5.005_03 will continue
0a08c020 2319to be usable by 5.005_03 but will also accessible to 5.6.0. Further,
d6baa268 2320suppose that you upgrade a module to one which requires features
0a08c020
GS
2321present only in 5.6.0. That new module will get installed into
2322/usr/local/lib/perl5/site_perl/5.6.0 and will be available to 5.6.0,
d6baa268 2323but will not interfere with the 5.005_03 version.
bfb7748a 2324
c42e3e15 2325The last entry, /usr/local/lib/perl5/site_perl/, is there so that
fe23a901 23265.6.0 and above will look for 5.004-era pure perl modules.
d6baa268 2327
cc65bb49
AD
2328Lastly, suppose you now install 5.8.0, which is not binary compatible
2329with 5.6.0. The directories searched by 5.8.0 (if you don't change the
fe23a901
RF
2330Configure defaults) will be:
2331
2332 /usr/local/lib/perl5/5.8.0/$archname
2333 /usr/local/lib/perl5/5.8.0
2334 /usr/local/lib/perl5/site_perl/5.8.0/$archname
2335 /usr/local/lib/perl5/site_perl/5.8.0
d6baa268 2336
0a08c020 2337 /usr/local/lib/perl5/site_perl/5.6.0
d6baa268 2338
d6baa268 2339 /usr/local/lib/perl5/site_perl/5.005
fe23a901 2340
d6baa268 2341 /usr/local/lib/perl5/site_perl/
bfb7748a 2342
cc65bb49
AD
2343Note that the earlier $archname entries are now gone, but pure perl
2344modules from earlier versions will still be found.
2345
0a08c020 2346Assuming the users in your site are still actively using perl 5.6.0 and
fe23a901 23475.005 after you installed 5.8.0, you can continue to install add-on
cc65bb49
AD
2348extensions using any of perl 5.8.0, 5.6.0, or 5.005. The installations
2349of these different versions remain distinct, but remember that the
2350newer versions of perl are automatically set up to search the
2351compatible site libraries of the older ones. This means that
2352installing a new XS extension with 5.005 will make it visible to both
23535.005 and 5.6.0, but not to 5.8.0. Installing a pure perl module with
23545.005 will make it visible to all three versions. Later, if you
2355install the same extension using, say, perl 5.8.0, it will override the
23565.005-installed version, but only for perl 5.8.0.
0a08c020
GS
2357
2358This way, you can choose to share compatible extensions, but also upgrade
2359to a newer version of an extension that may be incompatible with earlier
2360versions, without breaking the earlier versions' installations.
693762b4
AD
2361
2362=head2 Maintaining completely separate versions
4633a7c4 2363
1ec51d55 2364Many users prefer to keep all versions of perl in completely
d6baa268 2365separate directories. This guarantees that an update to one version
0a08c020
GS
2366won't interfere with another version. (The defaults guarantee this for
2367libraries after 5.6.0, but not for executables. TODO?) One convenient
2368way to do this is by using a separate prefix for each version, such as
d52d4e46 2369
9a664500 2370 sh Configure -Dprefix=/opt/perl5.8.2
d52d4e46 2371
9a664500 2372and adding /opt/perl5.8.2/bin to the shell PATH variable. Such users
d52d4e46
PP
2373may also wish to add a symbolic link /usr/local/bin/perl so that
2374scripts can still start with #!/usr/local/bin/perl.
2375
693762b4 2376Others might share a common directory for maintenance sub-versions
cc65bb49 2377(e.g. 5.8 for all 5.8.x versions), but change directory with
693762b4
AD
2378each major version.
2379
6877a1cf
AD
2380If you are installing a development subversion, you probably ought to
2381seriously consider using a separate directory, since development
2382subversions may not have all the compatibility wrinkles ironed out
2383yet.
2384
e655887d 2385=head2 Upgrading from 5.005 or 5.6 to 5.8.0
693762b4 2386
9a664500 2387B<Perl 5.9.0 is binary incompatible with Perl 5.8.x, Perl 5.6.x, 5.005,
e655887d
CB
2388and any earlier Perl release.> Perl modules having binary parts
2389(meaning that a C compiler is used) will have to be recompiled to be
9a664500
AMS
2390used with 5.9.0. If you find you do need to rebuild an extension with
23915.9.0, you may safely do so without disturbing the older
e655887d
CB
2392installations. (See L<"Coexistence with earlier versions of perl5">
2393above.)
c42e3e15
GS
2394
2395See your installed copy of the perllocal.pod file for a (possibly
2396incomplete) list of locally installed modules. Note that you want
cc65bb49 2397perllocal.pod, not perllocale.pod, for installed module information.
693762b4 2398
8e07c86e
AD
2399=head1 Coexistence with perl4
2400
2401You can safely install perl5 even if you want to keep perl4 around.
2402
1ec51d55
CS
2403By default, the perl5 libraries go into /usr/local/lib/perl5/, so
2404they don't override the perl4 libraries in /usr/local/lib/perl/.
8e07c86e
AD
2405
2406In your /usr/local/bin directory, you should have a binary named
1ec51d55 2407perl4.036. That will not be touched by the perl5 installation
8e07c86e
AD
2408process. Most perl4 scripts should run just fine under perl5.
2409However, if you have any scripts that require perl4, you can replace
d6baa268 2410the #! line at the top of them by #!/usr/local/bin/perl4.036 (or
4dc3e0af 2411whatever the appropriate pathname is). See L<perltrap> for
d6baa268 2412possible problems running perl4 scripts under perl5.
8e07c86e 2413
aa689395
PP
2414=head1 cd /usr/include; h2ph *.h sys/*.h
2415
d6baa268
JH
2416Some perl scripts need to be able to obtain information from the
2417system header files. This command will convert the most commonly used
1ec51d55 2418header files in /usr/include into files that can be easily interpreted
d6baa268
JH
2419by perl. These files will be placed in the architecture-dependent
2420library ($archlib) directory you specified to Configure.
aa689395 2421
d6baa268
JH
2422Note: Due to differences in the C and perl languages, the conversion
2423of the header files is not perfect. You will probably have to
2424hand-edit some of the converted files to get them to parse correctly.
2425For example, h2ph breaks spectacularly on type casting and certain
2426structures.
aa689395 2427
fb73857a 2428=head1 installhtml --help
aa689395 2429
3e3baf6d
TB
2430Some sites may wish to make perl documentation available in HTML
2431format. The installhtml utility can be used to convert pod
fb73857a 2432documentation into linked HTML files and install them.
aa689395 2433
d6baa268
JH
2434Currently, the supplied ./installhtml script does not make use of the
2435html Configure variables. This should be fixed in a future release.
2436
fb73857a 2437The following command-line is an example of one used to convert
3e3baf6d 2438perl documentation:
aa689395 2439
3e3baf6d
TB
2440 ./installhtml \
2441 --podroot=. \
2442 --podpath=lib:ext:pod:vms \
2443 --recurse \
2444 --htmldir=/perl/nmanual \
2445 --htmlroot=/perl/nmanual \
2446 --splithead=pod/perlipc \
2447 --splititem=pod/perlfunc \
2448 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
2449 --verbose
2450
2451See the documentation in installhtml for more details. It can take
2452many minutes to execute a large installation and you should expect to
2453see warnings like "no title", "unexpected directive" and "cannot
2454resolve" as the files are processed. We are aware of these problems
2455(and would welcome patches for them).
aa689395 2456
fb73857a
PP
2457You may find it helpful to run installhtml twice. That should reduce
2458the number of "cannot resolve" warnings.
2459
aa689395
PP
2460=head1 cd pod && make tex && (process the latex files)
2461
2462Some sites may also wish to make the documentation in the pod/ directory
2463available in TeX format. Type
2464
2465 (cd pod && make tex && <process the latex files>)
2466
8ebf57cf
JH
2467=head1 Minimizing the Perl installation
2468
2469The following section is meant for people worrying about squeezing the
2470Perl installation into minimal systems (for example when installing
2471operating systems, or in really small filesystems).
2472
c8214fdf 2473Leaving out as many extensions as possible is an obvious way:
5cda700b
AD
2474Encode, with its big conversion tables, consumes a lot of
2475space. On the other hand, you cannot throw away everything. The
2476Fcntl module is pretty essential. If you need to do network
c8214fdf
JH
2477programming, you'll appreciate the Socket module, and so forth: it all
2478depends on what do you need to do.
2479
8ebf57cf
JH
2480In the following we offer two different slimmed down installation
2481recipes. They are informative, not normative: the choice of files
2482depends on what you need.
2483
2484Firstly, the bare minimum to run this script
2485
2486 use strict;
2487 use warnings;
2488 foreach my $f (</*>) {
2489 print("$f\n");
2490 }
2491
2492in Solaris is as follows (under $Config{prefix}):
2493
2494 ./bin/perl
2495 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/DynaLoader/autosplit.ix
2496 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/DynaLoader/dl_expandspec.al
2497 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/DynaLoader/dl_find_symbol_anywhere.al
2498 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/DynaLoader/dl_findfile.al
2499 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/File/Glob/Glob.so
2500 ./lib/perl5/5.6.1/sun4-solaris-64int/auto/File/Glob/autosplit.ix
2501 ./lib/perl5/5.6.1/sun4-solaris-64int/Config.pm
2502 ./lib/perl5/5.6.1/sun4-solaris-64int/XSLoader.pm
2503 ./lib/perl5/5.6.1/sun4-solaris-64int/DynaLoader.pm
2504 ./lib/perl5/5.6.1/sun4-solaris-64int/CORE/libperl.so
2505 ./lib/perl5/5.6.1/strict.pm
2506 ./lib/perl5/5.6.1/warnings.pm
2507 ./lib/perl5/5.6.1/Carp.pm
2508 ./lib/perl5/5.6.1/Exporter.pm
2509 ./lib/perl5/5.6.1/File/Glob.pm
2510 ./lib/perl5/5.6.1/AutoLoader.pm
2511 ./lib/perl5/5.6.1/vars.pm
2512 ./lib/perl5/5.6.1/warnings/register.pm
2513 ./lib/perl5/5.6.1/Carp/Heavy.pm
2514 ./lib/perl5/5.6.1/Exporter/Heavy.pm
2515
2516Secondly, Debian perl-base package contains the following files,
2517size about 1.2MB in its i386 version:
2518
2519 /usr/share/doc/perl/Documentation
2520 /usr/share/doc/perl/README.Debian
2521 /usr/share/doc/perl/copyright
2522 /usr/share/doc/perl/AUTHORS.gz
2523 /usr/share/doc/perl/changelog.Debian.gz
2524 /usr/share/man/man1/perl.1.gz
2525 /usr/share/perl/5.6.1/AutoLoader.pm
2526 /usr/share/perl/5.6.1/Carp.pm
2527 /usr/share/perl/5.6.1/Carp/Heavy.pm
2528 /usr/share/perl/5.6.1/Cwd.pm
2529 /usr/share/perl/5.6.1/Exporter.pm
2530 /usr/share/perl/5.6.1/Exporter/Heavy.pm
2531 /usr/share/perl/5.6.1/File/Spec.pm
2532 /usr/share/perl/5.6.1/File/Spec/Unix.pm
2533 /usr/share/perl/5.6.1/FileHandle.pm
2534 /usr/share/perl/5.6.1/Getopt/Long.pm
2535 /usr/share/perl/5.6.1/IO/Socket/INET.pm
2536 /usr/share/perl/5.6.1/IO/Socket/UNIX.pm
2537 /usr/share/perl/5.6.1/IPC/Open2.pm
2538 /usr/share/perl/5.6.1/IPC/Open3.pm
2539 /usr/share/perl/5.6.1/SelectSaver.pm
2540 /usr/share/perl/5.6.1/Symbol.pm
2541 /usr/share/perl/5.6.1/Text/Tabs.pm
2542 /usr/share/perl/5.6.1/Text/Wrap.pm
2543 /usr/share/perl/5.6.1/attributes.pm
2544 /usr/share/perl/5.6.1/auto/Getopt/Long/GetOptions.al
2545 /usr/share/perl/5.6.1/auto/Getopt/Long/FindOption.al
2546 /usr/share/perl/5.6.1/auto/Getopt/Long/Configure.al
2547 /usr/share/perl/5.6.1/auto/Getopt/Long/config.al
2548 /usr/share/perl/5.6.1/auto/Getopt/Long/Croak.al
2549 /usr/share/perl/5.6.1/auto/Getopt/Long/autosplit.ix
2550 /usr/share/perl/5.6.1/base.pm
2551 /usr/share/perl/5.6.1/constant.pm
2552 /usr/share/perl/5.6.1/fields.pm
2553 /usr/share/perl/5.6.1/integer.pm
2554 /usr/share/perl/5.6.1/lib.pm
2555 /usr/share/perl/5.6.1/locale.pm
2556 /usr/share/perl/5.6.1/overload.pm
2557 /usr/share/perl/5.6.1/strict.pm
2558 /usr/share/perl/5.6.1/vars.pm
2559 /usr/share/perl/5.6.1/warnings.pm
2560 /usr/share/perl/5.6.1/warnings/register.pm
2561 /usr/bin/perl
2562 /usr/lib/perl/5.6.1/Config.pm
2563 /usr/lib/perl/5.6.1/Data/Dumper.pm
2564 /usr/lib/perl/5.6.1/DynaLoader.pm
2565 /usr/lib/perl/5.6.1/Errno.pm
2566 /usr/lib/perl/5.6.1/Fcntl.pm
2567 /usr/lib/perl/5.6.1/File/Glob.pm
2568 /usr/lib/perl/5.6.1/IO.pm
2569 /usr/lib/perl/5.6.1/IO/File.pm
2570 /usr/lib/perl/5.6.1/IO/Handle.pm
2571 /usr/lib/perl/5.6.1/IO/Pipe.pm
2572 /usr/lib/perl/5.6.1/IO/Seekable.pm
2573 /usr/lib/perl/5.6.1/IO/Select.pm
2574 /usr/lib/perl/5.6.1/IO/Socket.pm
2575 /usr/lib/perl/5.6.1/POSIX.pm
2576 /usr/lib/perl/5.6.1/Socket.pm
2577 /usr/lib/perl/5.6.1/XSLoader.pm
2578 /usr/lib/perl/5.6.1/auto/Data/Dumper/Dumper.so
2579 /usr/lib/perl/5.6.1/auto/Data/Dumper/Dumper.bs
2580 /usr/lib/perl/5.6.1/auto/DynaLoader/dl_findfile.al
2581 /usr/lib/perl/5.6.1/auto/DynaLoader/dl_expandspec.al
2582 /usr/lib/perl/5.6.1/auto/DynaLoader/dl_find_symbol_anywhere.al
2583 /usr/lib/perl/5.6.1/auto/DynaLoader/autosplit.ix
2584 /usr/lib/perl/5.6.1/auto/DynaLoader/DynaLoader.a
2585 /usr/lib/perl/5.6.1/auto/DynaLoader/extralibs.ld
2586 /usr/lib/perl/5.6.1/auto/Fcntl/Fcntl.so
2587 /usr/lib/perl/5.6.1/auto/Fcntl/Fcntl.bs
2588 /usr/lib/perl/5.6.1/auto/File/Glob/Glob.bs
2589 /usr/lib/perl/5.6.1/auto/File/Glob/Glob.so
2590 /usr/lib/perl/5.6.1/auto/File/Glob/autosplit.ix
2591 /usr/lib/perl/5.6.1/auto/IO/IO.so
2592 /usr/lib/perl/5.6.1/auto/IO/IO.bs
2593 /usr/lib/perl/5.6.1/auto/POSIX/POSIX.bs
2594 /usr/lib/perl/5.6.1/auto/POSIX/POSIX.so
2595 /usr/lib/perl/5.6.1/auto/POSIX/autosplit.ix
2596 /usr/lib/perl/5.6.1/auto/POSIX/load_imports.al
2597 /usr/lib/perl/5.6.1/auto/Socket/Socket.so
2598 /usr/lib/perl/5.6.1/auto/Socket/Socket.bs
2599
8e07c86e
AD
2600=head1 DOCUMENTATION
2601
bfb7748a
AD
2602Read the manual entries before running perl. The main documentation
2603is in the pod/ subdirectory and should have been installed during the
8e07c86e 2604build process. Type B<man perl> to get started. Alternatively, you
bfb7748a
AD
2605can type B<perldoc perl> to use the supplied perldoc script. This is
2606sometimes useful for finding things in the library modules.
8e07c86e 2607
1ec51d55 2608Under UNIX, you can produce a documentation book in postscript form,
bfb7748a
AD
2609along with its table of contents, by going to the pod/ subdirectory and
2610running (either):
34a2a22e
RM
2611
2612 ./roffitall -groff # If you have GNU groff installed
aa689395 2613 ./roffitall -psroff # If you have psroff
34a2a22e
RM
2614
2615This will leave you with two postscript files ready to be printed.
aa689395
PP
2616(You may need to fix the roffitall command to use your local troff
2617set-up.)
34a2a22e 2618
bfb7748a
AD
2619Note that you must have performed the installation already before running
2620the above, since the script collects the installed files to generate
2621the documentation.
34a2a22e 2622
8e07c86e
AD
2623=head1 AUTHOR
2624
bfb7748a
AD
2625Original author: Andy Dougherty doughera@lafayette.edu , borrowing very
2626heavily from the original README by Larry Wall, with lots of helpful
2627feedback and additions from the perl5-porters@perl.org folks.
fb73857a 2628
f5b3b617
AD
2629If you have problems, corrections, or questions, please see
2630L<"Reporting Problems"> above.
2631
2632=head1 REDISTRIBUTION
2633
2634This document is part of the Perl package and may be distributed under
d6baa268 2635the same terms as perl itself, with the following additional request:
f5b3b617 2636If you are distributing a modified version of perl (perhaps as part of
d6baa268
JH
2637a larger package) please B<do> modify these installation instructions
2638and the contact information to match your distribution.