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