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