This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixes for Interactive Unix
[perl5.git] / INSTALL
diff --git a/INSTALL b/INSTALL
index fb38c46..b629682 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -4,16 +4,24 @@ Install - Build and Installation guide for perl5.
 
 =head1 SYNOPSIS
 
-The basic steps to build and install perl5 are:
+The basic steps to build and install perl5 on a Unix system are:
 
        rm -f config.sh
        sh Configure
        make
        make test
        make install
+       # possibly add these:
+       (cd /usr/include  && h2ph *.h sys/*.h)
+       cd pod; make html && mv *.html <www home dir>  && cd ..
+       cd pod; make tex  && <process the latex files> && cd ..
+
 
 Each of these is explained in further detail below.
 
+For information on non-Unix systems, see the section on
+L<"Porting Information">, below.
+
 =head1 DESCRIPTION
 
 You should probably at least skim through this entire document before
@@ -51,7 +59,22 @@ re-use your old config.sh.  Simply remove it or rename it, e.g.
 
        mv config.sh config.sh.old
 
-Then run Configure.
+If you wish to use your old config.sh, be especially attentive to the
+version and architecture-specific questions and answers.  For example,
+the default directory for architecture-dependent library modules
+includes the version name.  By default, Configure will reuse your old
+name (e.g. /opt/perl/lib/i86pc-solaris/5.003) even if you're running
+Configure for a different version, e.g. 5.004.  Yes, Configure should
+probably check and correct for this, but it doesn't, presently.
+Similarly, if you used a shared libperl.so (see below) with version
+numbers, you will probably want to adjust them as well.
+
+Also, be careful to check your architecture name.  Some Linux systems
+call themselves i486, while others use i586.  If you pick up a
+precompiled binary, it might not use the same name.
+
+In short, if you wish to use your old config.sh, I recommend running
+Configure interactively rather than blindly accepting the defaults.
 
 =head1 Run Configure.
 
@@ -94,30 +117,34 @@ then Configure will suggest /opt/perl/lib instead of
 
 By default, Configure will compile perl to use dynamic loading, if
 your system supports it.  If you want to force perl to be compiled
-statically, you can either choose this when Configure prompts you or by
-using the Configure command line option -Uusedl.
+statically, you can either choose this when Configure prompts you or
+you can use the Configure command line option -Uusedl.
 
 =head2 Extensions
 
 By default, Configure will offer to build every extension which appears
 to be supported.  For example, Configure will offer to build GDBM_File
 only if it is able to find the gdbm library.  (See examples below.)
-DynaLoader, Fcntl and FileHandle are always built by default.
-Configure does not contain code to test for POSIX compliance, so POSIX
-is always built by default as well.  If you wish to skip POSIX, you can
-set the Configure variable useposix=false either in a hint file or from
-the Configure command line.  Similarly, the Opcode extension is always
-built by default, but you can skip it by setting the Configure variable
+DynaLoader, Fcntl, and IO are always built by default.  Configure does
+not contain code to test for POSIX compliance, so POSIX is always built
+by default as well.  If you wish to skip POSIX, you can set the
+Configure variable useposix=false either in a hint file or from the
+Configure command line.  Similarly, the Opcode extension is always built
+by default, but you can skip it by setting the Configure variable
 useopcode=false either in a hint file for from the command line.
 
+Even if you do not have dynamic loading, you must still build the
+DynaLoader extension; you should just build the stub dl_none.xs
+version.  (Configure will suggest this as the default.)
+
 In summary, here are the Configure command-line variables you can set
 to turn off each extension:
 
     DB_File            i_db
-    DynaLoader         (Must always be included)
+    DynaLoader         (Must always be included as a static extension)
     Fcntl              (Always included by default)
-    FileHandle         (Always included by default)
     GDBM_File          i_gdbm
+    IO                 (Always included by default)
     NDBM_File          i_ndbm
     ODBM_File          i_dbm
     POSIX              useposix
@@ -354,33 +381,33 @@ installed on multiple systems.  Here's one way to do that:
     cd /usr/local  # Or wherever you specified as $prefix
     tar xvf perl5-archive.tar
 
-=head2 Building a shared libperl5.so Perl library.
+=head2 Building a shared libperl.so Perl library.
 
 Currently, for most systems, the main perl executable is built by
 linking the "perl library" libperl.a with perlmain.o, your static
 extensions (usually just DynaLoader.a) and various extra libraries,
 such as -lm.
 
-On systems that support dynamic loading, it may be possible to replace
-libperl.a with a shared libperl5.so.  If you anticipate building
+On some systems that support dynamic loading, it may be possible to
+replace libperl.a with a shared libperl.so.  If you anticipate building
 several different perl binaries (e.g. by embedding libperl into
 different programs, or by using the optional compiler extension), then
-you might wish to build a shared libperl5.so so that all your binaries
+you might wish to build a shared libperl.so so that all your binaries
 can share the same library.
 
 The disadvantages are that there may be a significant performance
-penalty associated with the shared libperl5.so, and that the overall
+penalty associated with the shared libperl.so, and that the overall
 meachanism is still rather fragile with respect to different versions
 and upgrades.
 
 In terms of performance, on my test system (Solaris 2.5_x86) the perl
-test suite took roughly 15% longer to run with the shared libperl5.so.
+test suite took roughly 15% longer to run with the shared libperl.so.
 Your system and typical applications may well give quite different
 results.
 
 The default name for the shared library is typically something like
-libperl5.so.3.2 (for perl5.003_02) or libperl5.so.302 or simply
-libperl5.so.  Configure tries to guess a sensible naming convention
+libperl.so.3.2 (for perl5.003_02) or libperl.so.302 or simply
+libperl.so.  Configure tries to guess a sensible naming convention
 based on your C library name.  Since the library gets installed in a
 version-specific architecture-dependent directory, the exact name
 isn't very important anyway, as long as your linker is happy.
@@ -406,9 +433,28 @@ for Csh-style shells.  You *MUST* do this before running make.
 Folks running NeXT OPENSTEP must substitute DYLD_LIBRARY_PATH for
 LD_LIBRARY_PATH above.
 
+There is also an potential problem with the shared perl library if you
+want to have more than one "flavor" of the same version of perl (e.g.
+with and without -DDEBUGGING).  For example, suppose you build and
+install a standard perl5.004 with a shared library.  Then, suppose you
+try to build perl5.004 with -DDEBUGGING enabled, but everything else
+the same, including all the installation directories.  How can you
+ensure that your newly built perl will link with your newly built
+libperl.so.4 rather with the installed libperl.so.4?  The answer is
+that you might not be able to.  The installation directory is encoded
+in the perl binary with the LD_RUN_PATH environment variable (or
+equivalent ld command-line option).  On Solaris, you can override that
+with LD_LIBRARY_PATH; on Linux you can't.
+
+The only reliable answer is that you should specify a different
+directory for the architecture-dependent library for your -DDEBUGGING
+version of perl.  You can do this with by changing all the *archlib*
+variables in config.sh, namely archlib, archlib_exp, and
+installarchlib, to point to your new architecture-dependent library.
+
 =head2 Selecting File IO mechanisms
 
-Previous version of perl used the standard IO mechanisms as defined in
+Previous versions of perl used the standard IO mechanisms as defined in
 <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
 the default and is the only supported mechanism.
@@ -455,7 +501,7 @@ abstraction layer.  This configuration can be used to check that perl and
 extension modules have been correctly converted to use the PerlIO
 abstraction.
 
-This configuration should work on all platforms (but currently does not).
+This configuration should work on all platforms (but might not).
 
 You select this option via :
 
@@ -541,8 +587,12 @@ B<gcc>, you should almost always remove your old config.sh.
 
 =item Propagating your changes to config.sh
 
-If you later make any changes to F<config.sh>, you should propagate
-them to all the .SH files by running  B<sh Configure -S>.
+If you make any changes to F<config.sh>, you should propagate
+them to all the .SH files by running  B<sh Configure -S>.  You will
+then have to rebuild by running
+
+       make depend
+       make
 
 =item config.over
 
@@ -550,7 +600,7 @@ You can also supply a shell script config.over to over-ride Configure's
 guesses.  It will get loaded up at the very end, just before config.sh
 is created.  You have to be careful with this, however, as Configure
 does no checking that your changes make sense.  See the section on
-changing the installation directory for an example.
+L<"Changing the installation directory"> for an example.
 
 =item config.h
 
@@ -589,8 +639,29 @@ corresponing subdirectories.  Additional information, including
 a glossary of all those config.sh variables, is in the Porting
 subdirectory.
 
+Ports for other systems may also be available.  You should check out
+L<"http:/www.perl.com/CPAN/ports"> for current information on ports to
+various other operating systems.
+
 =back
 
+=head1 Binary Compatibility With 5.003
+
+Perl 5.003 turned on the EMBED feature by default, which tries to
+avoid possible symbol name conflict by prefixing all global symbols
+with "Perl_".  However, its list of global symbols was incomplete.
+This error has been rectified in Perl 5.004.
+
+However, some sites may need to maintain complete binary compatibility
+with Perl 5.003.  If you are building Perl for such a site, then after
+B<Configure> you should run these two commands:
+
+   perl old_embed.pl
+   sh old_perl_exp.SH
+
+These commands will make your new Perl as binary-compatible with
+version 5.003 as possible.
+
 =head1 make depend
 
 This will look for all the includes.
@@ -610,6 +681,16 @@ explicitly above.
 This will attempt to make perl in the current directory.
 
 If you can't compile successfully, try some of the following ideas.
+If none of them help, and careful reading of the error message and
+the relevant manual pages on your system doesn't help, you can
+send a message to either the comp.lang.perl.misc newsgroup or to
+perlbug@perl.com with an accurate description of your problem.
+Please include the I<output> of the B<./myconfig> shell script
+that comes with the distribution.
+
+[The B<perlbug> program that comes with the perl distribution is
+useful for sending in such reports, but you need to have
+perl compiled and installed before you can use it.]
 
 =over 4
 
@@ -627,18 +708,26 @@ during the building of extensions, you should run
 
 to test your version of miniperl.
 
+=item locale
+
+If you have any locale-related environment variables set, try
+unsetting them.  I have some reports that some versions of IRIX hang
+while running B<./miniperl configpm> with locales other than the C
+locale.  See the discussion under L<make test> below about locales.
+
 =item *
 
 If you get duplicates upon linking for malloc et al, say -DHIDEMYMALLOC.
 
-=item *
+=item varargs
 
 If you get varargs problems with gcc, be sure that gcc is installed
 correctly.  When using gcc, you should probably have i_stdarg='define'
 and i_varargs='undef' in config.sh.  The problem is usually solved by
 running fixincludes correctly.  If you do change config.sh, don't
-forget to propagate your changes with C<sh Configure -S>.  See also the
-vsprintf item below.
+forget to propagate your changes (see
+L<"Propagating your changes to config.sh"> below).
+See also the L<"vsprintf"> item below.
 
 =item *
 
@@ -650,9 +739,9 @@ numbers will vary in different versions of perl):
     proto.h:45: prototype declaration
 
 it might well be a symptom of the gcc "varargs problem".  See the
-previous item.
+previous L<"varargs"> item.
 
-=item *
+=item Solaris and SunOS dynamic loading
 
 If you have problems with dynamic loading using gcc on SunOS or
 Solaris, and you are using GNU as and GNU ld, you may need to add
@@ -663,6 +752,12 @@ environment variable to ensure that Sun's as and ld are used.  Consult
 your gcc documentation for further information on the B<-B> option and
 the GCC_EXEC_PREFIX variable.
 
+=item ld.so.1: ./perl: fatal: relocation error:
+
+If you get this message on SunOS or Solaris, and you're using gcc,
+it's probably the GNU as or GNU ld problem in the previous item
+L<"Solaris and SunOS dynamic loading">.
+
 =item *
 
 If you run into dynamic loading problems, check your setting of
@@ -694,7 +789,7 @@ or by answering the nm extraction question interactively.
 If you have previously run Configure, you should I<not> reuse your old
 config.sh.
 
-=item *
+=item vsprintf
 
 If you run into problems with vsprintf in compiling util.c, the
 problem is probably that Configure failed to detect your system's
@@ -710,13 +805,31 @@ re-running Configure without using nm extraction (see previous item).
 
 =item *
 
-If you can't compile successfully, try adding a C<-DCRIPPLED_CC> flag.
-(Just because you get no errors doesn't mean it compiled right!)
-This simplifies some complicated expressions for compilers that
-get indigestion easily.  If that has no effect, try turning off
-optimization.  If you have missing routines, you probably need to
-add some library or other, or you need to undefine some feature that
-Configure thought was there but is defective or incomplete.
+If you can't compile successfully, try turning off your compiler's
+optimizier.  Edit config.sh and change the line
+
+       optimize='-O'
+
+to something like
+
+       optimize=' '
+
+then propagate your changes with B<sh Configure -S> and rebuild
+with B<make depend; make>.
+
+=item *
+
+If you still can't compile successfully, try adding a C<-DCRIPPLED_CC>
+flag.  (Just because you get no errors doesn't mean it compiled right!)
+This simplifies some complicated expressions for compilers that get
+indigestion easily.
+
+=item Missing functions
+
+If you have missing routines, you probably need to add some library or
+other, or you need to undefine some feature that Configure thought was
+there but is defective or incomplete.  Look through config.h for
+likely suspects.
 
 =item *
 
@@ -727,11 +840,36 @@ F<cflags>.  It's okay to insert rules for specific files into
 F<makefile> since a default rule only takes effect in the absence of a
 specific rule.
 
-=item *
+=item Missing dbmclose
 
 SCO prior to 3.2.4 may be missing dbmclose().  An upgrade to 3.2.4
 that includes libdbm.nfs (which includes dbmclose()) may be available.
 
+=item Warning (will try anyway): No library found for -lposix
+
+If you see such a message during the building of an extension, but
+the extension passes its tests anyway (see L<"make test"> below),
+then don't worry about the warning message.  The extension
+Makefile.PL goes looking for various libraries needed on various
+systems; few systems will need all the possible libries listed.
+For example, a system may have -lcposix or -lposix, but it's
+unlikely to have both, so most users will see warnings for the one
+they don't have.  The message 'will try anyway' is intended to
+reassure you that the process is continuing.
+
+On the other hand, if you are building GDBM_File and you get the
+message
+
+    Warning (will try anyway): No library found for -lgdbm
+
+then it's likely you're going to run into trouble somewhere along
+the line, since it's hard to see how you can use the GDBM_File
+extension without the -lgdbm library.
+
+It is true that, in principle, Configure could have figured all of
+this out, but Configure and the extension building process are not
+quite that tightly coordinated.
+
 =item *
 
 Some additional things that have been reported for either perl4 or perl5:
@@ -746,6 +884,11 @@ If you get syntax errors on '(', try -DCRIPPLED_CC.
 
 Machines with half-implemented dbm routines will need to #undef I_ODBM
 
+db-recno failure on tests 51, 53 and 55:  Old versions of the DB library
+(including the DB library which comes with FreeBSD 2.1) had broken
+handling of recno databases with modified bval settings.  Upgrade your
+DB library or OS.
+
 =back
 
 =head1 make test
@@ -768,16 +911,18 @@ B<Note>: one possible reason for errors is that some external programs
 may be broken due to the combination of your environment and the way
 C<make test> exercises them.  For example, this may happen if you have
 one or more of these environment variables set: C<LC_ALL LC_CTYPE
-LANG>.  In some versions of UNIX, the non-English locales are known to
-cause programs to exhibit mysterious errors.  If you have any of the
-above environment variables set, please try C<setenv LC_ALL C> (for
-C shell) or <LC_ALL=C;export LC_ALL> (for Bourne or Korn shell) from the
-command line and then retry C<make test>. If the tests then succeed,
-you may have a broken program that is confusing the testing. Please run
-the troublesome test by hand as shown above and see whether you can
-locate the program.  Look for things like:
-C<exec, `backquoted command`, system, open("|...")> or C<open("...|")>.
-All these mean that Perl is trying to run some external program.
+LC_COLLATE LANG>.  In some versions of UNIX, the non-English locales
+are known to cause programs to exhibit mysterious errors.
+
+If you have any of the above environment variables set, please try
+C<setenv LC_ALL C> (for C shell) or <LC_ALL=C;export LC_ALL> (for
+Bourne or Korn shell) from the command line and then retry C<make
+test>.  If the tests then succeed, you may have a broken program that
+is confusing the testing. Please run the troublesome test by hand as
+shown above and see whether you can locate the program.  Look for
+things like: C<exec, `backquoted command`, system, open("|...")> or
+C<open("...|")>.  All these mean that Perl is trying to run some
+external program.
 
 =head1 INSTALLING PERL5
 
@@ -835,16 +980,10 @@ $sitearch listed in config.sh.  Usually, these are something like
 where $archname is something like sun4-sunos.  These directories
 will be used for installing extensions.
 
-Perl's *.h header files and the libperl.a library are also
-installed under $archlib so that any user may later build new
-extensions even if the Perl source is no longer available.
-
-The libperl.a library is only needed for building new
-extensions and linking them statically into a new perl executable.
-If you will not be doing that, then you may safely delete
-$archlib/libperl.a after perl is installed.
-
-make install may also offer to install perl in a "standard" location.
+Perl's *.h header files and the libperl.a library are also installed
+under $archlib so that any user may later build new extensions, run the
+optional Perl compiler, or embed the perl interpreter into another
+program even if the Perl source is no longer available.
 
 Most of the documentation in the pod/ directory is also available
 in HTML and LaTeX format.  Type
@@ -876,10 +1015,10 @@ spectacularly on type casting and certain structures.
 =head1 Coexistence with earlier versions of perl5.
 
 You can safely install the current version of perl5 and still run scripts
-under the old binaries for versions 5.002 and later ONLY.  Instead of
+under the old binaries for versions 5.003 and later ONLY.  Instead of
 starting your script with #!/usr/local/bin/perl, just start it with
-#!/usr/local/bin/perl5.001 (or whatever version you want to run.)
-If you want to retain a version of perl5 prior to perl5.002, you'll
+#!/usr/local/bin/perl5.003 (or whatever version you want to run.)
+If you want to retain a version of perl5 prior to perl5.003, you'll
 need to install the current version in a separate directory tree,
 since some of the architecture-independent library files have changed
 in incompatible ways.
@@ -916,14 +1055,15 @@ scripts can still start with #!/usr/local/bin/perl.
 B<NOTE>: Starting with 5.002_01, all functions in the perl C source
 code are protected by default by the prefix Perl_ (or perl_) so that
 you may link with third-party libraries without fear of namespace
-collisons.  This breaks compatability with the initially released
-version of 5.002, so once you install 5.002_01 (or higher) you will
+collisons.  This breaks compatability with
+version 5.002, so once you install 5.002_01 (or higher) you will
 need to re-build and install all of your dynamically loadable
 extensions.  (The standard extensions supplied with Perl are handled
 automatically).  You can turn off this namespace protection by adding
--DNO_EMBED to your ccflags variable in config.sh.  This is a one-time
-change.  In the future, we certainly hope that most extensions won't
-need to be recompiled for use with a newer version of perl.
+-DNO_EMBED to your ccflags variable in config.sh.
+
+In the future, we certainly hope that most extensions won't need to be
+recompiled for use with a newer version of perl.
 
 =head1 Coexistence with perl4
 
@@ -955,4 +1095,4 @@ from the original README by Larry Wall.
 
 =head1 LAST MODIFIED
 
-21 August 1996
+9 October 1996