Blame manual/install.texi

Packit 6c4009
@include macros.texi
Packit 6c4009
@include pkgvers.texi
Packit 6c4009
Packit 6c4009
@ifclear plain
Packit 6c4009
@node Installation, Maintenance, Library Summary, Top
Packit 6c4009
@end ifclear
Packit 6c4009
Packit 6c4009
@c %MENU% How to install the GNU C Library
Packit 6c4009
@appendix Installing @theglibc{}
Packit 6c4009
Packit 6c4009
Before you do anything else, you should read the FAQ at
Packit 6c4009
@url{https://sourceware.org/glibc/wiki/FAQ}.  It answers common
Packit 6c4009
questions and describes problems you may experience with compilation
Packit 6c4009
and installation.
Packit 6c4009
Packit 6c4009
You will need recent versions of several GNU tools: definitely GCC and
Packit 6c4009
GNU Make, and possibly others.  @xref{Tools for Compilation}, below.
Packit 6c4009
Packit 6c4009
@ifclear plain
Packit 6c4009
@menu
Packit 6c4009
* Configuring and compiling::   How to compile and test GNU libc.
Packit 6c4009
* Running make install::        How to install it once you've got it
Packit 6c4009
 compiled.
Packit 6c4009
* Tools for Compilation::       You'll need these first.
Packit 6c4009
* Linux::                       Specific advice for GNU/Linux systems.
Packit 6c4009
* Reporting Bugs::              So they'll get fixed.
Packit 6c4009
@end menu
Packit 6c4009
@end ifclear
Packit 6c4009
Packit 6c4009
@node Configuring and compiling
Packit 6c4009
@appendixsec Configuring and compiling @theglibc{}
Packit 6c4009
@cindex configuring
Packit 6c4009
@cindex compiling
Packit 6c4009
Packit 6c4009
@Theglibc{} cannot be compiled in the source directory.  You must build
Packit 6c4009
it in a separate build directory.  For example, if you have unpacked
Packit 6c4009
the @glibcadj{} sources in @file{/src/gnu/glibc-@var{version}},
Packit 6c4009
create a directory
Packit 6c4009
@file{/src/gnu/glibc-build} to put the object files in.  This allows
Packit 6c4009
removing the whole build directory in case an error occurs, which is
Packit 6c4009
the safest way to get a fresh start and should always be done.
Packit 6c4009
Packit 6c4009
From your object directory, run the shell script @file{configure} located
Packit 6c4009
at the top level of the source tree.  In the scenario above, you'd type
Packit 6c4009
Packit 6c4009
@smallexample
Packit 6c4009
$ ../glibc-@var{version}/configure @var{args@dots{}}
Packit 6c4009
@end smallexample
Packit 6c4009
Packit 6c4009
Please note that even though you're building in a separate build
Packit 6c4009
directory, the compilation may need to create or modify files and
Packit 6c4009
directories in the source directory.
Packit 6c4009
Packit 6c4009
@noindent
Packit 6c4009
@code{configure} takes many options, but the only one that is usually
Packit 6c4009
mandatory is @samp{--prefix}.  This option tells @code{configure}
Packit 6c4009
where you want @theglibc{} installed.  This defaults to @file{/usr/local},
Packit 6c4009
but the normal setting to install as the standard system library is
Packit 6c4009
@samp{--prefix=/usr} for @gnulinuxsystems{} and @samp{--prefix=} (an
Packit 6c4009
empty prefix) for @gnuhurdsystems{}.
Packit 6c4009
Packit 6c4009
It may also be useful to pass @samp{CC=@var{compiler}} and
Packit 6c4009
@code{CFLAGS=@var{flags}} arguments to @code{configure}.  @code{CC}
Packit 6c4009
selects the C compiler that will be used, and @code{CFLAGS} sets
Packit 6c4009
optimization options for the compiler.  Any compiler options required
Packit 6c4009
for all compilations, such as options selecting an ABI or a processor
Packit 6c4009
for which to generate code, should be included in @code{CC}.  Options
Packit 6c4009
that may be overridden by the @glibcadj{} build system for particular
Packit 6c4009
files, such as for optimization and debugging, should go in
Packit 6c4009
@code{CFLAGS}.  The default value of @code{CFLAGS} is @samp{-g -O2},
Packit 6c4009
and @theglibc{} cannot be compiled without optimization, so if
Packit 6c4009
@code{CFLAGS} is specified it must enable optimization.  For example:
Packit 6c4009
Packit 6c4009
@smallexample
Packit 6c4009
$ ../glibc-@var{version}/configure CC="gcc -m32" CFLAGS="-O3"
Packit 6c4009
@end smallexample
Packit 6c4009
Packit 6c4009
The following list describes all of the available options for
Packit 6c4009
 @code{configure}:
Packit 6c4009
Packit 6c4009
@table @samp
Packit 6c4009
@item --prefix=@var{directory}
Packit 6c4009
Install machine-independent data files in subdirectories of
Packit 6c4009
@file{@var{directory}}.  The default is to install in @file{/usr/local}.
Packit 6c4009
Packit 6c4009
@item --exec-prefix=@var{directory}
Packit 6c4009
Install the library and other machine-dependent files in subdirectories
Packit 6c4009
of @file{@var{directory}}.  The default is to the @samp{--prefix}
Packit 6c4009
directory if that option is specified, or @file{/usr/local} otherwise.
Packit 6c4009
Packit 6c4009
@item --with-headers=@var{directory}
Packit 6c4009
Look for kernel header files in @var{directory}, not
Packit 6c4009
@file{/usr/include}.  @Theglibc{} needs information from the kernel's header
Packit 6c4009
files describing the interface to the kernel.  @Theglibc{} will normally
Packit 6c4009
look in @file{/usr/include} for them,
Packit 6c4009
but if you specify this option, it will look in @var{DIRECTORY} instead.
Packit 6c4009
Packit 6c4009
This option is primarily of use on a system where the headers in
Packit 6c4009
@file{/usr/include} come from an older version of @theglibc{}.  Conflicts can
Packit 6c4009
occasionally happen in this case.  You can also use this option if you want to
Packit 6c4009
compile @theglibc{} with a newer set of kernel headers than the ones found in
Packit 6c4009
@file{/usr/include}.
Packit 6c4009
Packit 6c4009
@item --enable-kernel=@var{version}
Packit 6c4009
This option is currently only useful on @gnulinuxsystems{}.  The
Packit 6c4009
@var{version} parameter should have the form X.Y.Z and describes the
Packit 6c4009
smallest version of the Linux kernel the generated library is expected
Packit 6c4009
to support.  The higher the @var{version} number is, the less
Packit 6c4009
compatibility code is added, and the faster the code gets.
Packit 6c4009
Packit 6c4009
@item --with-binutils=@var{directory}
Packit 6c4009
Use the binutils (assembler and linker) in @file{@var{directory}}, not
Packit 6c4009
the ones the C compiler would default to.  You can use this option if
Packit 6c4009
the default binutils on your system cannot deal with all the constructs
Packit 6c4009
in @theglibc{}.  In that case, @code{configure} will detect the
Packit 6c4009
problem and suppress these constructs, so that the library will still be
Packit 6c4009
usable, but functionality may be lost---for example, you can't build a
Packit 6c4009
shared libc with old binutils.
Packit 6c4009
Packit Service 520acc
@item --with-nonshared-cflags=@var{cflags}
Packit Service 520acc
Use additional compiler flags @var{cflags} to build the parts of the
Packit Service 520acc
library which are always statically linked into applications and
Packit Service 520acc
libraries even with shared linking (that is, the object files contained
Packit Service 520acc
in @file{lib*_nonshared.a} libraries).  The build process will
Packit Service 520acc
automatically use the appropriate flags, but this option can be used to
Packit Service 520acc
set additional flags required for building applications and libraries,
Packit Service 520acc
to match local policy.
Packit Service 520acc
Packit 6c4009
@c disable static doesn't work currently
Packit 6c4009
@c @item --disable-static
Packit 6c4009
@c Don't build static libraries.  Static libraries aren't that useful these
Packit 6c4009
@c days, but we recommend you build them in case you need them.
Packit 6c4009
Packit 6c4009
@item --disable-shared
Packit 6c4009
Don't build shared libraries even if it is possible.  Not all systems
Packit 6c4009
support shared libraries; you need ELF support and (currently) the GNU
Packit 6c4009
linker.
Packit 6c4009
Packit 6c4009
@item --enable-static-pie
Packit 6c4009
Enable static position independent executable (static PIE) support.
Packit 6c4009
Static PIE is similar to static executable, but can be loaded at any
Packit 6c4009
address without help from a dynamic linker.  All static programs as
Packit 6c4009
well as static tests are built as static PIE, except for those marked
Packit 6c4009
with no-pie.  The resulting glibc can be used with the GCC option,
Packit 6c4009
-static-pie, which is available with GCC 8 or above, to create static
Packit 6c4009
PIE.  This option also implies that glibc programs and tests are created
Packit 6c4009
as dynamic position independent executables (PIE) by default.
Packit 6c4009
Packit 6c4009
@item --enable-cet
Packit Service 98d15e
@itemx --enable-cet=permissive
Packit 6c4009
Enable Intel Control-flow Enforcement Technology (CET) support.  When
Packit Service 98d15e
@theglibc{} is built with @option{--enable-cet} or
Packit Service 98d15e
@option{--enable-cet=permissive}, the resulting library
Packit 6c4009
is protected with indirect branch tracking (IBT) and shadow stack
Packit 6c4009
(SHSTK)@.  When CET is enabled, @theglibc{} is compatible with all
Packit 6c4009
existing executables and shared libraries.  This feature is currently
Packit 6c4009
supported on i386, x86_64 and x32 with GCC 8 and binutils 2.29 or later.
Packit 6c4009
Note that when CET is enabled, @theglibc{} requires CPUs capable of
Packit 6c4009
multi-byte NOPs, like x86-64 processors as well as Intel Pentium Pro or
Packit Service 98d15e
newer.  With @option{--enable-cet}, it is an error to dlopen a non CET
Packit Service 98d15e
enabled shared library in CET enabled application.  With
Packit Service 98d15e
@option{--enable-cet=permissive}, CET is disabled when dlopening a
Packit Service 98d15e
non CET enabled shared library in CET enabled application.
Packit 6c4009
Packit 6c4009
NOTE: @option{--enable-cet} has been tested for i686, x86_64 and x32
Packit 6c4009
on non-CET processors.  @option{--enable-cet} has been tested for
Packit Service 98d15e
i686, x86_64 and x32 on CET processors.
Packit 6c4009
Packit 6c4009
@item --disable-profile
Packit 6c4009
Don't build libraries with profiling information.  You may want to use
Packit 6c4009
this option if you don't plan to do profiling.
Packit 6c4009
Packit 6c4009
@item --enable-static-nss
Packit 6c4009
Compile static versions of the NSS (Name Service Switch) libraries.
Packit 6c4009
This is not recommended because it defeats the purpose of NSS; a program
Packit 6c4009
linked statically with the NSS libraries cannot be dynamically
Packit 6c4009
reconfigured to use a different name database.
Packit 6c4009
Packit 6c4009
@item --enable-hardcoded-path-in-tests
Packit 6c4009
By default, dynamic tests are linked to run with the installed C library.
Packit 6c4009
This option hardcodes the newly built C library path in dynamic tests
Packit 6c4009
so that they can be invoked directly.
Packit 6c4009
Packit 6c4009
@item --disable-timezone-tools
Packit 6c4009
By default, timezone related utilities (@command{zic}, @command{zdump},
Packit 6c4009
and @command{tzselect}) are installed with @theglibc{}.  If you are building
Packit 6c4009
these independently (e.g. by using the @samp{tzcode} package), then this
Packit 6c4009
option will allow disabling the install of these.
Packit 6c4009
Packit 6c4009
Note that you need to make sure the external tools are kept in sync with
Packit 6c4009
the versions that @theglibc{} expects as the data formats may change over
Packit 6c4009
time.  Consult the @file{timezone} subdirectory for more details.
Packit 6c4009
Packit 6c4009
@item --enable-stack-protector
Packit 6c4009
@itemx --enable-stack-protector=strong
Packit 6c4009
@itemx --enable-stack-protector=all
Packit 6c4009
Compile the C library and all other parts of the glibc package
Packit 6c4009
(including the threading and math libraries, NSS modules, and
Packit 6c4009
transliteration modules) using the GCC @option{-fstack-protector},
Packit 6c4009
@option{-fstack-protector-strong} or @option{-fstack-protector-all}
Packit 6c4009
options to detect stack overruns.  Only the dynamic linker and a small
Packit 6c4009
number of routines called directly from assembler are excluded from this
Packit 6c4009
protection.
Packit 6c4009
Packit 6c4009
@item --enable-bind-now
Packit Service 1411a8
Disable lazy binding for installed shared objects and programs.  This
Packit Service 1411a8
provides additional security hardening because it enables full RELRO
Packit Service 1411a8
and a read-only global offset table (GOT), at the cost of slightly
Packit Service 1411a8
increased program load times.
Packit 6c4009
Packit 6c4009
@pindex pt_chown
Packit 6c4009
@findex grantpt
Packit 6c4009
@item --enable-pt_chown
Packit 6c4009
The file @file{pt_chown} is a helper binary for @code{grantpt}
Packit 6c4009
(@pxref{Allocation, Pseudo-Terminals}) that is installed setuid root to
Packit 6c4009
fix up pseudo-terminal ownership.  It is not built by default because
Packit 6c4009
systems using the Linux kernel are commonly built with the @code{devpts}
Packit 6c4009
filesystem enabled and mounted at @file{/dev/pts}, which manages
Packit 6c4009
pseudo-terminal ownership automatically.  By using
Packit 6c4009
@samp{--enable-pt_chown}, you may build @file{pt_chown} and install it
Packit 6c4009
setuid and owned by @code{root}.  The use of @file{pt_chown} introduces
Packit 6c4009
additional security risks to the system and you should enable it only if
Packit 6c4009
you understand and accept those risks.
Packit 6c4009
Packit 6c4009
@item --disable-werror
Packit 6c4009
By default, @theglibc{} is built with @option{-Werror}.  If you wish
Packit 6c4009
to build without this option (for example, if building with a newer
Packit 6c4009
version of GCC than this version of @theglibc{} was tested with, so
Packit 6c4009
new warnings cause the build with @option{-Werror} to fail), you can
Packit 6c4009
configure with @option{--disable-werror}.
Packit 6c4009
Packit 6c4009
@item --disable-mathvec
Packit 6c4009
By default for x86_64, @theglibc{} is built with the vector math library.
Packit 6c4009
Use this option to disable the vector math library.
Packit 6c4009
Packit 6c4009
@item --enable-tunables
Packit 6c4009
Tunables support allows additional library parameters to be customized at
Packit 6c4009
runtime.  This feature is enabled by default.  This option can take the
Packit 6c4009
following values:
Packit 6c4009
Packit 6c4009
@table @code
Packit 6c4009
@item yes
Packit 6c4009
This is the default if no option is passed to configure. This enables tunables
Packit 6c4009
and selects the default frontend (currently @samp{valstring}).
Packit 6c4009
Packit 6c4009
@item no
Packit 6c4009
This option disables tunables.
Packit 6c4009
Packit 6c4009
@item valstring
Packit 6c4009
This enables tunables and selects the @samp{valstring} frontend for tunables.
Packit 6c4009
This frontend allows users to specify tunables as a colon-separated list in a
Packit 6c4009
single environment variable @env{GLIBC_TUNABLES}.
Packit 6c4009
@end table
Packit 6c4009
Packit 6c4009
@item --enable-obsolete-nsl
Packit 6c4009
By default, libnsl is only built as shared library for backward
Packit 6c4009
compatibility and the NSS modules libnss_compat, libnss_nis and
Packit 6c4009
libnss_nisplus are not built at all.
Packit 6c4009
Use this option to enable libnsl with all depending NSS modules and
Packit 6c4009
header files.
Packit 6c4009
Packit 6c4009
@item --disable-crypt
Packit 6c4009
Do not install the passphrase-hashing library @file{libcrypt} or the
Packit 6c4009
header file @file{crypt.h}.  @file{unistd.h} will still declare the
Packit 6c4009
function @code{crypt}.  Using this option does not change the set of
Packit 6c4009
programs that may need to be linked with @option{-lcrypt}; it only
Packit 6c4009
means that @theglibc{} will not provide that library.
Packit 6c4009
Packit 6c4009
This option is for hackers and distributions experimenting with
Packit 6c4009
independently-maintained implementations of libcrypt.  It may become
Packit 6c4009
the default in a future release.
Packit 6c4009
Packit 6c4009
@item --disable-experimental-malloc
Packit 6c4009
By default, a per-thread cache is enabled in @code{malloc}.  While
Packit 6c4009
this cache can be disabled on a per-application basis using tunables
Packit 6c4009
(set glibc.malloc.tcache_count to zero), this option can be used to
Packit 6c4009
remove it from the build completely.
Packit 6c4009
Packit 6c4009
@item --build=@var{build-system}
Packit 6c4009
@itemx --host=@var{host-system}
Packit 6c4009
These options are for cross-compiling.  If you specify both options and
Packit 6c4009
@var{build-system} is different from @var{host-system}, @code{configure}
Packit 6c4009
will prepare to cross-compile @theglibc{} from @var{build-system} to be used
Packit 6c4009
on @var{host-system}.  You'll probably need the @samp{--with-headers}
Packit 6c4009
option too, and you may have to override @var{configure}'s selection of
Packit 6c4009
the compiler and/or binutils.
Packit 6c4009
Packit 6c4009
If you only specify @samp{--host}, @code{configure} will prepare for a
Packit 6c4009
native compile but use what you specify instead of guessing what your
Packit 6c4009
system is.  This is most useful to change the CPU submodel.  For example,
Packit 6c4009
if @code{configure} guesses your machine as @code{i686-pc-linux-gnu} but
Packit 6c4009
you want to compile a library for 586es, give
Packit 6c4009
@samp{--host=i586-pc-linux-gnu} or just @samp{--host=i586-linux} and add
Packit 6c4009
the appropriate compiler flags (@samp{-mcpu=i586} will do the trick) to
Packit 6c4009
@code{CC}.
Packit 6c4009
Packit 6c4009
If you specify just @samp{--build}, @code{configure} will get confused.
Packit 6c4009
Packit 6c4009
@item --with-pkgversion=@var{version}
Packit 6c4009
Specify a description, possibly including a build number or build
Packit 6c4009
date, of the binaries being built, to be included in
Packit 6c4009
@option{--version} output from programs installed with @theglibc{}.
Packit 6c4009
For example, @option{--with-pkgversion='FooBar GNU/Linux glibc build
Packit 6c4009
123'}.  The default value is @samp{GNU libc}.
Packit 6c4009
Packit 6c4009
@item --with-bugurl=@var{url}
Packit 6c4009
Specify the URL that users should visit if they wish to report a bug,
Packit 6c4009
to be included in @option{--help} output from programs installed with
Packit 6c4009
@theglibc{}.  The default value refers to the main bug-reporting
Packit 6c4009
information for @theglibc{}.
Packit 6c4009
@end table
Packit 6c4009
Packit 6c4009
To build the library and related programs, type @code{make}.  This will
Packit 6c4009
produce a lot of output, some of which may look like errors from
Packit 6c4009
@code{make} but aren't.  Look for error messages from @code{make}
Packit 6c4009
containing @samp{***}.  Those indicate that something is seriously wrong.
Packit 6c4009
Packit 6c4009
The compilation process can take a long time, depending on the
Packit 6c4009
configuration and the speed of your machine.  Some complex modules may
Packit 6c4009
take a very long time to compile, as much as several minutes on slower
Packit 6c4009
machines.  Do not panic if the compiler appears to hang.
Packit 6c4009
Packit 6c4009
If you want to run a parallel make, simply pass the @samp{-j} option
Packit 6c4009
with an appropriate numeric parameter to @code{make}.  You need a recent
Packit 6c4009
GNU @code{make} version, though.
Packit 6c4009
Packit 6c4009
To build and run test programs which exercise some of the library
Packit 6c4009
facilities, type @code{make check}.  If it does not complete
Packit 6c4009
successfully, do not use the built library, and report a bug after
Packit 6c4009
verifying that the problem is not already known.  @xref{Reporting Bugs},
Packit 6c4009
for instructions on reporting bugs.  Note that some of the tests assume
Packit 6c4009
they are not being run by @code{root}.  We recommend you compile and
Packit 6c4009
test @theglibc{} as an unprivileged user.
Packit 6c4009
Packit 6c4009
Before reporting bugs make sure there is no problem with your system.
Packit 6c4009
The tests (and later installation) use some pre-existing files of the
Packit 6c4009
system such as @file{/etc/passwd}, @file{/etc/nsswitch.conf} and others.
Packit 6c4009
These files must all contain correct and sensible content.
Packit 6c4009
Packit 6c4009
Normally, @code{make check} will run all the tests before reporting
Packit 6c4009
all problems found and exiting with error status if any problems
Packit 6c4009
occurred.  You can specify @samp{stop-on-test-failure=y} when running
Packit 6c4009
@code{make check} to make the test run stop and exit with an error
Packit 6c4009
status immediately when a failure occurs.
Packit 6c4009
Packit 6c4009
The @glibcadj{} pretty printers come with their own set of scripts for testing,
Packit 6c4009
which run together with the rest of the testsuite through @code{make check}.
Packit 6c4009
These scripts require the following tools to run successfully:
Packit 6c4009
Packit 6c4009
@itemize @bullet
Packit 6c4009
@item
Packit 6c4009
Python 2.7/3.4 or later
Packit 6c4009
Packit 6c4009
Python is required for running the printers' test scripts. As of release time,
Packit 6c4009
Python 3.6 is the newest verified to work to test the pretty printers.
Packit 6c4009
Packit 6c4009
@item PExpect 4.0
Packit 6c4009
Packit 6c4009
The printer tests drive GDB through test programs and compare its output
Packit 6c4009
to the printers'.  PExpect is used to capture the output of GDB, and should be
Packit 6c4009
compatible with the Python version in your system. As of release time
Packit 6c4009
PExpect 4.3 is the newest verified to work to test the pretty printers.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GDB 7.8 or later with support for Python 2.7/3.4 or later
Packit 6c4009
Packit 6c4009
GDB itself needs to be configured with Python support in order to use the
Packit 6c4009
pretty printers.  Notice that your system having Python available doesn't imply
Packit 6c4009
that GDB supports it, nor that your system's Python and GDB's have the same
Packit 6c4009
version. As of release time GNU @code{debugger} 8.0.1 is the newest verified
Packit 6c4009
to work to test the pretty printers.
Packit 6c4009
@end itemize
Packit 6c4009
Packit 6c4009
@noindent
Packit 6c4009
If these tools are absent, the printer tests will report themselves as
Packit 6c4009
@code{UNSUPPORTED}.  Notice that some of the printer tests require @theglibc{}
Packit 6c4009
to be compiled with debugging symbols.
Packit 6c4009
Packit 6c4009
To format the @cite{GNU C Library Reference Manual} for printing, type
Packit 6c4009
@w{@code{make dvi}}.  You need a working @TeX{} installation to do
Packit 6c4009
this.  The distribution builds the on-line formatted version of the
Packit 6c4009
manual, as Info files, as part of the build process.  You can build
Packit 6c4009
them manually with @w{@code{make info}}.
Packit 6c4009
Packit 6c4009
The library has a number of special-purpose configuration parameters
Packit 6c4009
which you can find in @file{Makeconfig}.  These can be overwritten with
Packit 6c4009
the file @file{configparms}.  To change them, create a
Packit 6c4009
@file{configparms} in your build directory and add values as appropriate
Packit 6c4009
for your system.  The file is included and parsed by @code{make} and has
Packit 6c4009
to follow the conventions for makefiles.
Packit 6c4009
Packit 6c4009
It is easy to configure @theglibc{} for cross-compilation by
Packit 6c4009
setting a few variables in @file{configparms}.  Set @code{CC} to the
Packit 6c4009
cross-compiler for the target you configured the library for; it is
Packit 6c4009
important to use this same @code{CC} value when running
Packit 6c4009
@code{configure}, like this: @samp{configure @var{target}
Packit 6c4009
CC=@var{target}-gcc}.  Set @code{BUILD_CC} to the compiler to use for programs
Packit 6c4009
run on the build system as part of compiling the library.  You may need to
Packit 6c4009
set @code{AR} to cross-compiling versions of @code{ar}
Packit 6c4009
if the native tools are not configured to work with
Packit 6c4009
object files for the target you configured for.  When cross-compiling
Packit 6c4009
@theglibc{}, it may be tested using @samp{make check
Packit 6c4009
test-wrapper="@var{srcdir}/scripts/cross-test-ssh.sh @var{hostname}"},
Packit 6c4009
where @var{srcdir} is the absolute directory name for the main source
Packit 6c4009
directory and @var{hostname} is the host name of a system that can run
Packit 6c4009
the newly built binaries of @theglibc{}.  The source and build
Packit 6c4009
directories must be visible at the same locations on both the build
Packit 6c4009
system and @var{hostname}.
Packit 6c4009
Packit 6c4009
In general, when testing @theglibc{}, @samp{test-wrapper} may be set
Packit 6c4009
to the name and arguments of any program to run newly built binaries.
Packit 6c4009
This program must preserve the arguments to the binary being run, its
Packit 6c4009
working directory and the standard input, output and error file
Packit 6c4009
descriptors.  If @samp{@var{test-wrapper} env} will not work to run a
Packit 6c4009
program with environment variables set, then @samp{test-wrapper-env}
Packit 6c4009
must be set to a program that runs a newly built program with
Packit 6c4009
environment variable assignments in effect, those assignments being
Packit 6c4009
specified as @samp{@var{var}=@var{value}} before the name of the
Packit 6c4009
program to be run.  If multiple assignments to the same variable are
Packit 6c4009
specified, the last assignment specified must take precedence.
Packit 6c4009
Similarly, if @samp{@var{test-wrapper} env -i} will not work to run a
Packit 6c4009
program with an environment completely empty of variables except those
Packit 6c4009
directly assigned, then @samp{test-wrapper-env-only} must be set; its
Packit 6c4009
use has the same syntax as @samp{test-wrapper-env}, the only
Packit 6c4009
difference in its semantics being starting with an empty set of
Packit 6c4009
environment variables rather than the ambient set.
Packit 6c4009
Packit 6c4009
Packit 6c4009
@node Running make install
Packit 6c4009
@appendixsec Installing the C Library
Packit 6c4009
@cindex installing
Packit 6c4009
Packit 6c4009
To install the library and its header files, and the Info files of the
Packit 6c4009
manual, type @code{make install}.  This will
Packit 6c4009
build things, if necessary, before installing them; however, you should
Packit 6c4009
still compile everything first.  If you are installing @theglibc{} as your
Packit 6c4009
primary C library, we recommend that you shut the system down to
Packit 6c4009
single-user mode first, and reboot afterward.  This minimizes the risk
Packit 6c4009
of breaking things when the library changes out from underneath.
Packit 6c4009
Packit 6c4009
@samp{make install} will do the entire job of upgrading from a
Packit 6c4009
previous installation of @theglibc{} version 2.x.  There may sometimes
Packit 6c4009
be headers
Packit 6c4009
left behind from the previous installation, but those are generally
Packit 6c4009
harmless.  If you want to avoid leaving headers behind you can do
Packit 6c4009
things in the following order.
Packit 6c4009
Packit 6c4009
You must first build the library (@samp{make}), optionally check it
Packit 6c4009
(@samp{make check}), switch the include directories and then install
Packit 6c4009
(@samp{make install}).  The steps must be done in this order.  Not moving
Packit 6c4009
the directory before install will result in an unusable mixture of header
Packit 6c4009
files from both libraries, but configuring, building, and checking the
Packit 6c4009
library requires the ability to compile and run programs against the old
Packit 6c4009
library.  The new @file{/usr/include}, after switching the include
Packit 6c4009
directories and before installing the library should contain the Linux
Packit 6c4009
headers, but nothing else.  If you do this, you will need to restore
Packit 6c4009
any headers from libraries other than @theglibc{} yourself after installing the
Packit 6c4009
library.
Packit 6c4009
Packit 6c4009
You can install @theglibc{} somewhere other than where you configured
Packit 6c4009
it to go by setting the @code{DESTDIR} GNU standard make variable on
Packit 6c4009
the command line for @samp{make install}.  The value of this variable
Packit 6c4009
is prepended to all the paths for installation.  This is useful when
Packit 6c4009
setting up a chroot environment or preparing a binary distribution.
Packit 6c4009
The directory should be specified with an absolute file name. Installing
Packit 6c4009
with the @code{prefix} and @code{exec_prefix} GNU standard make variables
Packit 6c4009
set is not supported.
Packit 6c4009
Packit 6c4009
@Theglibc{} includes a daemon called @code{nscd}, which you
Packit 6c4009
may or may not want to run.  @code{nscd} caches name service lookups; it
Packit 6c4009
can dramatically improve performance with NIS+, and may help with DNS as
Packit 6c4009
well.
Packit 6c4009
Packit 6c4009
One auxiliary program, @file{/usr/libexec/pt_chown}, is installed setuid
Packit 6c4009
@code{root} if the @samp{--enable-pt_chown} configuration option is used.
Packit 6c4009
This program is invoked by the @code{grantpt} function; it sets the
Packit 6c4009
permissions on a pseudoterminal so it can be used by the calling process.
Packit 6c4009
If you are using a Linux kernel with the @code{devpts} filesystem enabled
Packit 6c4009
and mounted at @file{/dev/pts}, you don't need this program.
Packit 6c4009
Packit 6c4009
After installation you might want to configure the timezone and locale
Packit 6c4009
installation of your system.  @Theglibc{} comes with a locale
Packit 6c4009
database which gets configured with @code{localedef}.  For example, to
Packit 6c4009
set up a German locale with name @code{de_DE}, simply issue the command
Packit 6c4009
@samp{localedef -i de_DE -f ISO-8859-1 de_DE}.  To configure all locales
Packit 6c4009
that are supported by @theglibc{}, you can issue from your build directory the
Packit 6c4009
command @samp{make localedata/install-locales}.
Packit 6c4009
Packit 6c4009
To configure the locally used timezone, set the @code{TZ} environment
Packit 6c4009
variable.  The script @code{tzselect} helps you to select the right value.
Packit 6c4009
As an example, for Germany, @code{tzselect} would tell you to use
Packit 6c4009
@samp{TZ='Europe/Berlin'}.  For a system wide installation (the given
Packit 6c4009
paths are for an installation with @samp{--prefix=/usr}), link the
Packit 6c4009
timezone file which is in @file{/usr/share/zoneinfo} to the file
Packit 6c4009
@file{/etc/localtime}.  For Germany, you might execute @samp{ln -s
Packit 6c4009
/usr/share/zoneinfo/Europe/Berlin /etc/localtime}.
Packit 6c4009
Packit 6c4009
@node Tools for Compilation
Packit 6c4009
@appendixsec Recommended Tools for Compilation
Packit 6c4009
@cindex installation tools
Packit 6c4009
@cindex tools, for installing library
Packit 6c4009
Packit 6c4009
We recommend installing the following GNU tools before attempting to
Packit 6c4009
build @theglibc{}:
Packit 6c4009
Packit 6c4009
@itemize @bullet
Packit 6c4009
@item
Packit 6c4009
GNU @code{make} 4.0 or newer
Packit 6c4009
Packit 6c4009
As of relase time, GNU @code{make} 4.2.1 is the newest verified to work
Packit 6c4009
to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GCC 4.9 or newer
Packit 6c4009
Packit 6c4009
GCC 4.9 or higher is required.  In general it is recommended to use
Packit 6c4009
the newest version of the compiler that is known to work for building
Packit 6c4009
@theglibc{}, as newer compilers usually produce better code.  As of
Packit 6c4009
release time, GCC 8.1.1 is the newest compiler verified to work to build
Packit 6c4009
@theglibc{}.
Packit 6c4009
Packit 6c4009
For PowerPC 64-bits little-endian (powerpc64le), GCC 6.2 or higher is
Packit 6c4009
required.  This compiler version is the first to provide the features
Packit 6c4009
required for building @theglibc{} with support for @code{_Float128}.
Packit 6c4009
Packit 6c4009
For multi-arch support it is recommended to use a GCC which has been built with
Packit 6c4009
support for GNU indirect functions.  This ensures that correct debugging
Packit 6c4009
information is generated for functions selected by IFUNC resolvers.  This
Packit 6c4009
support can either be enabled by configuring GCC with
Packit 6c4009
@samp{--enable-gnu-indirect-function}, or by enabling it by default by setting
Packit 6c4009
@samp{default_gnu_indirect_function} variable for a particular architecture in
Packit 6c4009
the GCC source file @file{gcc/config.gcc}.
Packit 6c4009
Packit 6c4009
You can use whatever compiler you like to compile programs that use
Packit 6c4009
@theglibc{}.
Packit 6c4009
Packit 6c4009
Check the FAQ for any special compiler issues on particular platforms.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GNU @code{binutils} 2.25 or later
Packit 6c4009
Packit 6c4009
You must use GNU @code{binutils} (as and ld) to build @theglibc{}.
Packit 6c4009
No other assembler or linker has the necessary functionality at the
Packit 6c4009
moment. As of release time, GNU @code{binutils} 2.31.1 is the newest
Packit 6c4009
verified to work to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GNU @code{texinfo} 4.7 or later
Packit 6c4009
Packit 6c4009
To correctly translate and install the Texinfo documentation you need
Packit 6c4009
this version of the @code{texinfo} package.  Earlier versions do not
Packit 6c4009
understand all the tags used in the document, and the installation
Packit 6c4009
mechanism for the info files is not present or works differently.
Packit 6c4009
As of release time, @code{texinfo} 6.5 is the newest verified to work
Packit 6c4009
to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GNU @code{awk} 3.1.2, or higher
Packit 6c4009
Packit 6c4009
@code{awk} is used in several places to generate files.
Packit 6c4009
Some @code{gawk} extensions are used, including the @code{asorti}
Packit 6c4009
function, which was introduced in version 3.1.2 of @code{gawk}.
Packit 6c4009
As of release time, @code{gawk} version 4.2.1 is the newest verified
Packit 6c4009
to work to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GNU @code{bison} 2.7 or later
Packit 6c4009
Packit 6c4009
@code{bison} is used to generate the @code{yacc} parser code in the @file{intl}
Packit 6c4009
subdirectory.  As of release time, @code{bison} version 3.0.4 is the newest
Packit 6c4009
verified to work to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
Perl 5
Packit 6c4009
Packit 6c4009
Perl is not required, but it is used if present to test the
Packit 6c4009
installation.  We may decide to use it elsewhere in the future. As of release
Packit 6c4009
time @code{perl} version 5.28.0 is the newest verified to work to build
Packit 6c4009
@theglibc{}.
Packit 6c4009
Packit 6c4009
@item
Packit 6c4009
GNU @code{sed} 3.02 or newer
Packit 6c4009
Packit 6c4009
@code{Sed} is used in several places to generate files.  Most scripts work
Packit 6c4009
with any version of @code{sed}.  As of release time, @code{sed} version
Packit 6c4009
4.5 is the newest verified to work to build @theglibc{}.
Packit 6c4009
Packit 6c4009
@end itemize
Packit 6c4009
Packit 6c4009
@noindent
Packit 6c4009
If you change any of the @file{configure.ac} files you will also need
Packit 6c4009
Packit 6c4009
@itemize @bullet
Packit 6c4009
@item
Packit 6c4009
GNU @code{autoconf} 2.69 (exactly)
Packit 6c4009
@end itemize
Packit 6c4009
Packit 6c4009
@noindent
Packit 6c4009
and if you change any of the message translation files you will need
Packit 6c4009
Packit 6c4009
@itemize @bullet
Packit 6c4009
@item
Packit 6c4009
GNU @code{gettext} 0.10.36 or later
Packit 6c4009
Packit 6c4009
As of release time, GNU @code{gettext} version 0.19.8.1 is the newest
Packit 6c4009
version verified to work to build @theglibc{}.
Packit 6c4009
@end itemize
Packit 6c4009
Packit 6c4009
Packit 6c4009
@noindent
Packit 6c4009
You may also need these packages if you upgrade your source tree using
Packit 6c4009
patches, although we try to avoid this.
Packit 6c4009
Packit 6c4009
@node Linux
Packit 6c4009
@appendixsec Specific advice for @gnulinuxsystems{}
Packit 6c4009
@cindex kernel header files
Packit 6c4009
Packit 6c4009
If you are installing @theglibc{} on @gnulinuxsystems{}, you need to have
Packit 6c4009
the header files from a 3.2 or newer kernel around for reference.
Packit 6c4009
(For the ia64 architecture, you need version 3.2.18 or newer because this
Packit 6c4009
is the first version with support for the @code{accept4} system call.)
Packit 6c4009
These headers must be installed using @samp{make headers_install}; the
Packit 6c4009
headers present in the kernel source directory are not suitable for
Packit 6c4009
direct use by @theglibc{}.  You do not need to use that kernel, just have
Packit 6c4009
its headers installed where @theglibc{} can access them, referred to here as
Packit 6c4009
@var{install-directory}.  The easiest way to do this is to unpack it
Packit 6c4009
in a directory such as @file{/usr/src/linux-@var{version}}.  In that
Packit 6c4009
directory, run @samp{make headers_install
Packit 6c4009
INSTALL_HDR_PATH=@var{install-directory}}.  Finally, configure @theglibc{}
Packit 6c4009
with the option @samp{--with-headers=@var{install-directory}/include}.
Packit 6c4009
Use the most recent kernel you can get your hands on.  (If you are
Packit 6c4009
cross-compiling @theglibc{}, you need to specify
Packit 6c4009
@samp{ARCH=@var{architecture}} in the @samp{make headers_install}
Packit 6c4009
command, where @var{architecture} is the architecture name used by the
Packit 6c4009
Linux kernel, such as @samp{x86} or @samp{powerpc}.)
Packit 6c4009
Packit 6c4009
After installing @theglibc{}, you may need to remove or rename
Packit 6c4009
directories such as @file{/usr/include/linux} and
Packit 6c4009
@file{/usr/include/asm}, and replace them with copies of directories
Packit 6c4009
such as @file{linux} and @file{asm} from
Packit 6c4009
@file{@var{install-directory}/include}.  All directories present in
Packit 6c4009
@file{@var{install-directory}/include} should be copied, except that
Packit 6c4009
@theglibc{} provides its own version of @file{/usr/include/scsi}; the
Packit 6c4009
files provided by the kernel should be copied without replacing those
Packit 6c4009
provided by @theglibc{}.  The @file{linux}, @file{asm} and
Packit 6c4009
@file{asm-generic} directories are required to compile programs using
Packit 6c4009
@theglibc{}; the other directories describe interfaces to the kernel but
Packit 6c4009
are not required if not compiling programs using those interfaces.
Packit 6c4009
You do not need to copy kernel headers if you did not specify an
Packit 6c4009
alternate kernel header source using @samp{--with-headers}.
Packit 6c4009
Packit 6c4009
The Filesystem Hierarchy Standard for @gnulinuxsystems{} expects some
Packit 6c4009
components of the @glibcadj{} installation to be in
Packit 6c4009
@file{/lib} and some in @file{/usr/lib}.  This is handled automatically
Packit 6c4009
if you configure @theglibc{} with @samp{--prefix=/usr}.  If you set some other
Packit 6c4009
prefix or allow it to default to @file{/usr/local}, then all the
Packit 6c4009
components are installed there.
Packit 6c4009
Packit 6c4009
@node Reporting Bugs
Packit 6c4009
@appendixsec Reporting Bugs
Packit 6c4009
@cindex reporting bugs
Packit 6c4009
@cindex bugs, reporting
Packit 6c4009
Packit 6c4009
There are probably bugs in @theglibc{}.  There are certainly
Packit 6c4009
errors and omissions in this manual.  If you report them, they will get
Packit 6c4009
fixed.  If you don't, no one will ever know about them and they will
Packit 6c4009
remain unfixed for all eternity, if not longer.
Packit 6c4009
Packit 6c4009
It is a good idea to verify that the problem has not already been
Packit 6c4009
reported.  Bugs are documented in two places: The file @file{BUGS}
Packit 6c4009
describes a number of well known bugs and the central @glibcadj{}
Packit 6c4009
bug tracking system has a
Packit 6c4009
WWW interface at
Packit 6c4009
@url{https://sourceware.org/bugzilla/}.  The WWW
Packit 6c4009
interface gives you access to open and closed reports.  A closed report
Packit 6c4009
normally includes a patch or a hint on solving the problem.
Packit 6c4009
Packit 6c4009
To report a bug, first you must find it.  With any luck, this will be the
Packit 6c4009
hard part.  Once you've found a bug, make sure it's really a bug.  A
Packit 6c4009
good way to do this is to see if @theglibc{} behaves the same way
Packit 6c4009
some other C library does.  If so, probably you are wrong and the
Packit 6c4009
libraries are right (but not necessarily).  If not, one of the libraries
Packit 6c4009
is probably wrong.  It might not be @theglibc{}.  Many historical
Packit 6c4009
Unix C libraries permit things that we don't, such as closing a file
Packit 6c4009
twice.
Packit 6c4009
Packit 6c4009
If you think you have found some way in which @theglibc{} does not
Packit 6c4009
conform to the ISO and POSIX standards (@pxref{Standards and
Packit 6c4009
Portability}), that is definitely a bug.  Report it!
Packit 6c4009
Packit 6c4009
Once you're sure you've found a bug, try to narrow it down to the
Packit 6c4009
smallest test case that reproduces the problem.  In the case of a C
Packit 6c4009
library, you really only need to narrow it down to one library
Packit 6c4009
function call, if possible.  This should not be too difficult.
Packit 6c4009
Packit 6c4009
The final step when you have a simple test case is to report the bug.
Packit 6c4009
Do this at @value{REPORT_BUGS_TO}.
Packit 6c4009
Packit 6c4009
If you are not sure how a function should behave, and this manual
Packit 6c4009
doesn't tell you, that's a bug in the manual.  Report that too!  If the
Packit 6c4009
function's behavior disagrees with the manual, then either the library
Packit 6c4009
or the manual has a bug, so report the disagreement.  If you find any
Packit 6c4009
errors or omissions in this manual, please report them to the
Packit 6c4009
bug database.  If you refer to specific
Packit 6c4009
sections of the manual, please include the section names for easier
Packit 6c4009
identification.