Update.
[glibc.git] / manual / install.texi
blob0348a235253dfab8b2df766650cb61ea8aa57156
1 @c This is for making the `INSTALL' file for the distribution.
2 @c Makeinfo ignores it when processing the file from the include.
3 @setfilename INSTALL
5 @node Installation, Maintenance, Library Summary, Top
6 @c %MENU% How to install the GNU C library
7 @appendix Installing the GNU C Library
9 Before you do anything else, you should read the file @file{FAQ} found
10 at the top level of the source tree.  This file answers common questions
11 and describes problems you may experience with compilation and
12 installation.  It is updated more frequently than this manual.
14 Features can be added to GNU Libc via @dfn{add-on} bundles.  These are
15 separate tarfiles which you unpack into the top level of the source
16 tree.  Then you give @code{configure} the @samp{--enable-add-ons} option
17 to activate them, and they will be compiled into the library.  As of the
18 2.1 release, two important components of glibc are distributed as
19 ``official'' add-ons.  Unless you are doing an unusual installation, you
20 should get them both.
22 Support for POSIX threads is maintained by someone else, so it's in a
23 separate package.  It is only available for Linux systems, but this will
24 change in the future.  Get it from the same place you got the main
25 bundle; the file is @file{glibc-linuxthreads-@var{VERSION}.tar.gz}.
26 Support for the @code{crypt} function is distributed separately because
27 of United States export restrictions.  If you are outside the US or
28 Canada, you must get @code{crypt} support from a site outside the US,
29 such as @samp{ftp.ifi.uio.no}.
30 @c Check this please someone:
31 (Most non-US mirrors of @samp{ftp.gnu.org} will have it too.)  The file
32 you need is @file{glibc-crypt-@var{VERSION}.tar.gz}.
34 You will need recent versions of several GNU tools: definitely GCC and
35 GNU Make, and possibly others.  @xref{Tools for Compilation}, below.
37 @menu
38 * Configuring and compiling::   How to compile and test GNU libc.
39 * Running make install::        How to install it once you've got it compiled.
40 * Tools for Compilation::       You'll need these first.
41 * Supported Configurations::    What it runs on, what it doesn't.
42 * Linux::                       Specific advice for Linux systems.
43 * Reporting Bugs::              So they'll get fixed.
44 @end menu
46 @node Configuring and compiling
47 @appendixsec Configuring and compiling GNU Libc
48 @cindex configuring
49 @cindex compiling
51 GNU Libc cannot be compiled in the source directory.  You must create a
52 separate directory for the object files.  This directory should be
53 outside the source tree.  For example, if you have unpacked the glibc
54 sources in @file{/src/gnu/glibc-2.1.0}, create a directory
55 @file{/src/gnu/glibc-build} to put the object files in.
57 From your object directory, run the shell script @file{configure} found
58 at the top level of the source tree.  In the scenario above, you'd type
60 @smallexample
61 $ ../glibc-2.1.0/configure @var{args...}
62 @end smallexample
64 @noindent
65 @code{configure} takes many options, but you can get away with knowing
66 only two: @samp{--prefix} and @samp{--enable-add-ons}.  The
67 @code{--prefix} option tells configure where you want glibc installed.
68 This defaults to @file{/usr/local}.  The @samp{--enable-add-ons} option
69 tells configure to use all the add-on bundles it finds in the source
70 directory.  Since important functionality is provided in add-ons, you
71 should always give this option.
73 It may also be useful to set the @var{CC} and @var{CFLAGS} variables in
74 the environment when running @code{configure}.  @var{CC} selects the C
75 compiler that will be used, and @var{CFLAGS} sets optimization options
76 for the compiler.
78 Here are all the useful options known by @code{configure}:
80 @table @samp
81 @item --prefix=@var{directory}
82 Install machine-independent data files in subdirectories of
83 @file{@var{directory}}.  The default is to install in @file{/usr/local}.
85 @item --exec-prefix=@var{directory}
86 Install the library and other machine-dependent files in subdirectories
87 of @file{@var{directory}}.  The default is to the @samp{--prefix}
88 directory if that option is given, or @file{/usr/local} otherwise.
90 @item --with-headers=@var{directory}
91 Look for kernel header files in @var{directory}, not
92 @file{/usr/include}.  Glibc needs information from the kernel's private
93 header files.  It will normally look in @file{/usr/include} for them,
94 but if you give this option, it will look in @var{DIRECTORY} instead.
96 This option is primarily of use on a system where the headers in
97 @file{/usr/include} come from an older version of glibc.  Conflicts can
98 occasionally happen in this case.  Note that Linux libc5 qualifies as an
99 older version of glibc.  You can also use this option if you want to
100 compile glibc with a newer set of kernel headers than the ones found in
101 @file{/usr/include}.
103 @item --enable-add-ons[=@var{list}]
104 Enable add-on packages in your source tree.  If this option is given
105 with no list, it enables all the add-on packages it finds.  If you do
106 not wish to use some add-on package that you have present in your source
107 tree, give this option a list of the add-ons that you @emph{do} want
108 used, like this: @samp{--enable-add-ons=crypt,linuxthreads}
110 @item --with-binutils=@var{directory}
111 Use the binutils (assembler and linker) in @file{@var{directory}}, not
112 the ones the C compiler would default to.  You could use this option if
113 the default binutils on your system cannot deal with all the constructs
114 in the GNU C library.  (@code{configure} will detect the problem and
115 suppress these constructs, so the library will still be usable, but
116 functionality may be lost---for example, you can not build a shared libc
117 with old binutils.)
119 @item --without-fp
120 Use this option if your computer lacks hardware floating-point support
121 and your operating system does not emulate an FPU.
123 @item --disable-static
124 Don't build static libraries.  Static libraries aren't that useful these
125 days, but we recommend you build them in case you need them.
127 @item --disable-shared
128 Don't build shared libraries even if we could.  Not all systems support
129 shared libraries; you need ELF support and (currently) the GNU linker.
131 @item --disable-profile
132 Don't build libraries with profiling information.  You may want to use
133 this option if you don't plan to do profiling.
135 @item --enable-omitfp
136 Use maximum optimization for the normal (static and shared)
137 libraries, and compile separate static libraries with debugging
138 information and no optimisation.  We recommend against this.  The extra
139 optimization doesn't gain you much, it may provoke compiler bugs, and
140 you won't be able to trace bugs through the C library.
142 @item --disable-versioning
143 Don't compile the shared libraries with symbol version information.
144 Doing this will make the library that's built incompatible with old
145 binaries, so it's not recommended.
147 @item --enable-static-nss
148 Compile static versions of the NSS (Name Service Switch) libraries.
149 This is not recommended because it defeats the purpose of NSS; a program
150 linked statically with the NSS libraries cannot be dynamically
151 reconfigured to use a different name database.
153 @item --build=@var{build-system}
154 @itemx --host=@var{host-system}
155 These options are for cross-compiling.  If you give them both and
156 @var{build-system} is different from @var{host-system}, @code{configure}
157 will prepare to cross-compile glibc from @var{build-system} to be used
158 on @var{host-system}.  You'll probably need the @samp{--with-headers}
159 option too, and you may have to override @var{configure}'s selection of
160 the compiler and/or binutils.
162 If you give just @samp{--host}, configure will prepare for a native
163 compile but use what you say instead of guessing what your system is.
164 This is most useful to change the CPU submodel.  For example, if
165 configure guesses your machine as @code{i586-pc-linux-gnu} but you want
166 to compile a library optimized for 386es, give
167 @samp{--host=i386-pc-linux-gnu} or just @samp{--host=i386-linux}.  (A
168 library compiled for a Pentium (@code{i586}) will still work on a 386,
169 but it may be slower.)
171 If you give just @samp{--build}, configure will get confused.
172 @end table
174 To build the library and related programs, type @code{make}.  This will
175 produce a lot of output, some of which may look like errors from
176 @code{make} but isn't.  Look for error messages from @code{make}
177 containing @samp{***}.  Those indicate that something is really wrong.
179 The compilation process takes several hours even on fast hardware.
180 Expect at least two hours for the default configuration on i586 for
181 Linux.  For Hurd times are much longer.  Except for EGCS 1.1 (and later
182 versions of EGCS), all supported versions of GCC have a problem which
183 causes them to take several minutes to compile certain files in the
184 iconvdata directory.  Do not panic if the compiler appears to hang.
186 If you want to run a parallel make, you can't just give @code{make} the
187 @samp{-j} option, because it won't be passed down to the sub-makes.
188 Instead, edit the generated @file{Makefile} and uncomment the line
190 @smallexample
191 # PARALLELMFLAGS = -j 4
192 @end smallexample
194 @noindent
195 You can change the @samp{4} to some other number as appropriate for
196 your system.
198 To build and run some test programs which exercise some of the library
199 facilities, type @code{make check}.  This should complete successfully;
200 if it doesn't, do not use the built library, and report a bug.
201 @xref{Reporting Bugs}, for how to do that.  Note that some of the tests
202 assume they are not being run by @code{root}.  We recommend you compile
203 and test glibc as an unprivileged user.
205 To format the @cite{GNU C Library Reference Manual} for printing, type
206 @w{@code{make dvi}}.  You need a working @TeX{} installation to do this.
207 The distribution already includes the on-line formatted version of the
208 manual, as Info files.  You can regenerate those with @w{@code{make
209 info}}, but it shouldn't be necessary.
211 @node Running make install
212 @appendixsec Installing the C Library
213 @cindex installing
215 To install the library and its header files, and the Info files of the
216 manual, type @code{make install}.  This will build things if necessary,
217 before installing them.  Don't rely on that; compile everything first.
218 If you are installing glibc as your primary C library, we recommend you
219 shut the system down to single-user mode first, and reboot afterward.
220 This minimizes the risk of breaking things when the library changes out
221 from underneath.
223 If you are upgrading from a previous installation of glibc 2.0 or 2.1,
224 @samp{make install} will do the entire job.  If you're upgrading from
225 Linux libc5 or some other C library, you need to rename the old
226 @file{/usr/include} directory out of the way first, or you will end up
227 with a mixture of header files from both libraries, and you won't be
228 able to compile anything.  You may also need to reconfigure GCC to work
229 with the new library.  The easiest way to do that is to figure out the
230 compiler switches to make it work again
231 (@samp{-Wl,-dynamic-linker=/lib/ld-linux.so.2} should work on Linux
232 systems) and use them to recompile gcc.  You can also edit the specs
233 file (@file{/usr/lib/gcc-lib/@var{TARGET}/@var{VERSION}/specs}), but
234 that is a bit of a black art.
236 You can install glibc somewhere other than where you configured it to go
237 by setting the @code{install_root} variable on the command line for
238 @samp{make install}.  The value of this variable is prepended to all the
239 paths for installation.  This is useful when setting up a chroot
240 environment or preparing a binary distribution.
242 Glibc 2.1 includes two daemons, @code{nscd} and @code{utmpd}, which you
243 may or may not want to run.  @code{nscd} caches name service lookups; it
244 can dramatically improve performance with NIS+, and may help with DNS as
245 well.  @code{utmpd} allows programs that use the old format for the
246 @file{utmp} file to coexist with new programs.  For more information see
247 the files @file{nscd/README} and @file{login/README.utmpd}.
249 One auxiliary program, @file{/usr/libexec/pt_chown}, is installed setuid
250 @code{root}.  This program is invoked by the @code{grantpt} function; it
251 sets the permissions on a pseudoterminal so it can be used by the
252 calling process.  This means programs like @code{xterm} and
253 @code{screen} do not have to be setuid to get a pty.  (There may be
254 other reasons why they need privileges.)  If you are using a 2.1 Linux
255 kernel with the @code{devptsfs} or @code{devfs} filesystems providing
256 pty slaves, you don't need this program; otherwise you do.  The source
257 for @file{pt_chown} is in @file{login/programs/pt_chown.c}.
259 @node Tools for Compilation
260 @appendixsec Recommended Tools for Compilation
261 @cindex installation tools
262 @cindex tools, for installing library
264 We recommend installing the following GNU tools before attempting to
265 build the GNU C library:
267 @itemize @bullet
268 @item
269 GNU @code{make} 3.75
271 You need the latest version of GNU @code{make}.  Modifying the GNU C
272 Library to work with other @code{make} programs would be so hard that we
273 recommend you port GNU @code{make} instead.  @strong{Really.}  We
274 recommend version GNU @code{make} version 3.75 or 3.77.  All earlier
275 versions have severe bugs or lack features. Version 3.76 is known to
276 have bugs which only show up in big projects like GNU @code{libc}.
277 Version 3.76.1 seems OK but some people have reported problems.
279 @item
280 EGCS 1.1 or 1.0.3
282 The GNU C library can only be compiled with the GNU C compiler family.
283 We recommend EGCS 1.0.3 or higher.  GCC 2.8.1 and older versions of EGCS
284 may have problems, particularly on non-Intel architectures.  GCC 2.7.x
285 has catastrophic bugs and cannot be used at all.  (You can use GCC 2.7.x
286 to compile programs that use GNU libc, but you may have problems,
287 particularly with the math functions.)
289 @item
290 GNU @code{binutils} 2.8.1.0.23, 2.9.1, or 2.9.0.15
292 You must use GNU binutils (as and ld) if you want to build a shared
293 library.  Even if you don't, we recommend you use them anyway.  No one
294 has tested compilation with non-GNU binutils in a long time.
296 The quality of binutils releases has varied a bit recently.  The bugs
297 are in obscure features, but glibc uses quite a few of those.
298 2.8.1.0.23, 2.9.1, and 2.9.0.15 are known to work.  Versions after
299 2.8.1.0.23 may or may not work.  Older versions definitely don't.
301 @item
302 GNU @code{texinfo} 3.11
304 To correctly translate and install the Texinfo documentation you need
305 this version of the @code{texinfo} package.  Earlier versions do not
306 understand all the tags used in the document, and the installation
307 mechanism for the info files is not present or works differently.
309 @item
310 GNU @code{awk} 3.0, or some other POSIX awk
312 Awk is used in several places to generate files.  The scripts should
313 work with any POSIX-compliant awk implementation; @code{gawk} 3.0 and
314 @code{mawk} 1.3 are known to work.
316 @item
317 Perl 5
319 Perl is not required, but it is used if present to test the
320 installation.  We may decide to use it elsewhere in the future.
322 @end itemize
324 @noindent
325 If you change any of the @file{configure.in} files you will also need
327 @itemize @bullet
328 @item
329 GNU @code{autoconf} 2.12
330 @end itemize
332 @noindent
333 and if you change any of the message translation files you will need
335 @itemize @bullet
336 @item
337 GNU @code{gettext} 0.10.35 or later
338 @end itemize
340 @noindent
341 You may also need these packages if you upgrade your source tree using
342 patches, although we try to avoid this.
344 @node Supported Configurations
345 @appendixsec Supported Configurations
346 @cindex configurations, all supported
348 The GNU C Library currently supports configurations that match the
349 following patterns:
351 @smallexample
352 alpha-@var{*}-linux
353 arm-@var{*}-linux
354 arm-@var{*}-linuxaout
355 arm-@var{*}-none
356 i@var{x}86-@var{*}-gnu
357 i@var{x}86-@var{*}-linux
358 m68k-@var{*}-linux
359 powerpc-@var{*}-linux
360 sparc-@var{*}-linux
361 sparc64-@var{*}-linux
362 @end smallexample
364 Former releases of this library (version 1.09.1 and perhaps earlier
365 versions) used to run on the following configurations:
367 @smallexample
368 alpha-dec-osf1
369 alpha-@var{*}-linuxecoff
370 i@var{x}86-@var{*}-bsd4.3
371 i@var{x}86-@var{*}-isc2.2
372 i@var{x}86-@var{*}-isc3.@var{n}
373 i@var{x}86-@var{*}-sco3.2
374 i@var{x}86-@var{*}-sco3.2v4
375 i@var{x}86-@var{*}-sysv
376 i@var{x}86-@var{*}-sysv4
377 i@var{x}86-force_cpu386-none
378 i@var{x}86-sequent-bsd
379 i960-nindy960-none
380 m68k-hp-bsd4.3
381 m68k-mvme135-none
382 m68k-mvme136-none
383 m68k-sony-newsos3
384 m68k-sony-newsos4
385 m68k-sun-sunos4.@var{n}
386 mips-dec-ultrix4.@var{n}
387 mips-sgi-irix4.@var{n}
388 sparc-sun-solaris2.@var{n}
389 sparc-sun-sunos4.@var{n}
390 @end smallexample
392 Since no one has volunteered to test and fix these configurations,
393 they are not supported at the moment.  They probably don't compile;
394 they definitely don't work anymore.  Porting the library is not hard.
395 If you are interested in doing a port, please contact the glibc
396 maintainers by sending electronic mail to @email{bug-glibc@@gnu.org}.
398 Each case of @samp{i@var{x}86} can be @samp{i386}, @samp{i486},
399 @samp{i586}, or @samp{i686}.  All of those configurations produce a
400 library that can run on any of these processors.  The library will be
401 optimized for the specified processor, but will not use instructions not
402 available on all of them.  If you want the library to use instructions
403 only available on newer processors, give GCC the appropriate @samp{-m}
404 switches via @var{CFLAGS}.
406 @node Linux
407 @appendixsec Specific advice for Linux systems
408 @cindex upgrading from libc5
409 @cindex kernel header files
411 If you are installing GNU libc on a Linux system, you need to have the
412 header files from a development kernel around for reference.  You do not
413 need to use the development kernel, just have its headers where glibc
414 can get at them.  The easiest way to do this is to unpack a development
415 kernel in a directory such as @file{/usr/src/linux-dev}.  In that
416 directory, run @samp{make config} and accept all the defaults.  Then
417 configure glibc with the option
418 @samp{--with-headers=/usr/src/linux-dev/include}.  Use the latest
419 development kernel you can get your hands on.
421 An alternate tactic is to unpack the development kernel and run
422 @samp{make config} as above.  Then rename or delete @file{/usr/include},
423 create a new @file{/usr/include}, and make the usual symbolic links of
424 @file{/usr/include/linux} and @file{/usr/include/asm} into the
425 development kernel sources.  You can then configure glibc with no
426 special options.  This tactic is recommended if you are upgrading from
427 libc5, since you need to get rid of the old header files anyway.
429 Note that @file{/usr/include/net} and @file{/usr/include/scsi} should
430 @strong{not} be symlinks into the kernel sources.  GNU libc provides its
431 own versions of these files.
433 Linux expects some components of the libc installation to be in
434 @file{/lib} and some in @file{/usr/lib}.  This is handled automatically
435 if you configure glibc with @samp{--prefix=/usr}.  If you set some other
436 prefix or allow it to default to @file{/usr/local}, then all the
437 components are installed there.
439 If you are upgrading from libc5, you need to recompile every shared
440 library on your system against the new library for the sake of new code,
441 but keep the old libraries around for old binaries to use.  This is
442 complicated and difficult.  Consult the Glibc2 HOWTO at
443 @url{http://www.imaxx.net/~thrytis/glibc} for details.
445 You cannot use @code{nscd} with 2.0 kernels, due to bugs in the
446 kernel-side thread support.  @code{nscd} happens to hit these bugs
447 particularly hard, but you might have problems with any threaded
448 program.
450 @node Reporting Bugs
451 @appendixsec Reporting Bugs
452 @cindex reporting bugs
453 @cindex bugs, reporting
455 There are probably bugs in the GNU C library.  There are certainly
456 errors and omissions in this manual.  If you report them, they will get
457 fixed.  If you don't, no one will ever know about them and they will
458 remain unfixed for all eternity, if not longer.
460 To report a bug, first you must find it.  Hopefully, this will be the
461 hard part.  Once you've found a bug, make sure it's really a bug.  A
462 good way to do this is to see if the GNU C library behaves the same way
463 some other C library does.  If so, probably you are wrong and the
464 libraries are right (but not necessarily).  If not, one of the libraries
465 is probably wrong.  It might not be the GNU library.  Many historical
466 Unix C libraries permit things that we don't, such as closing a file
467 twice.
469 If you think you have found some way in which the GNU C library does not
470 conform to the ISO and POSIX standards (@pxref{Standards and
471 Portability}), that is definitely a bug.  Report it!
473 Once you're sure you've found a bug, try to narrow it down to the
474 smallest test case that reproduces the problem.  In the case of a C
475 library, you really only need to narrow it down to one library
476 function call, if possible.  This should not be too difficult.
478 The final step when you have a simple test case is to report the bug.
479 Do this using the @code{glibcbug} script.  It is installed with libc, or
480 if you haven't installed it, will be in your build directory.  Send your
481 test case, the results you got, the results you expected, and what you
482 think the problem might be (if you've thought of anything).
483 @code{glibcbug} will insert the configuration information we need to
484 see, and ship the report off to @email{bug-glibc@@gnu.org}.  Don't send
485 a message there directly; it is fed to a program that expects mail to be
486 formatted in a particular way.  Use the script.
488 If you are not sure how a function should behave, and this manual
489 doesn't tell you, that's a bug in the manual.  Report that too!  If the
490 function's behavior disagrees with the manual, then either the library
491 or the manual has a bug, so report the disagreement.  If you find any
492 errors or omissions in this manual, please report them to the Internet
493 address @email{bug-glibc-manual@@gnu.org}.  If you refer to specific
494 sections when reporting on the manual, please include the section names
495 for easier identification.