Linux - The GNU C Library

Next: Reporting Bugs, Previous: Tools for Compilation, Up: Installation

### C.4 Specific advice for GNU/Linux systems

If you are installing GNU libc on a GNU/Linux system, you need to have the header files from a 2.2 or newer kernel around for reference. For some architectures, like ia64, sh and hppa, you need at least headers from kernel 2.3.99 (sh and hppa) or 2.4.0 (ia64). You do not need to use that kernel, just have its headers where glibc can access at them. The easiest way to do this is to unpack it in a directory such as `/usr/src/linux-2.2.1`. In that directory, run ‘`make config`’ and accept all the defaults. Then run ‘`make include/linux/version.h`’. Finally, configure glibc with the option ‘`--with-headers=/usr/src/linux-2.2.1/include`’. Use the most recent kernel you can get your hands on.

An alternate tactic is to unpack the 2.2 kernel and run ‘`make config`’ as above; then, rename or delete `/usr/include`, create a new `/usr/include`, and make symbolic links of `/usr/include/linux` and `/usr/include/asm` into the kernel sources. You can then configure glibc with no special options. This tactic is recommended if you are upgrading from libc5, since you need to get rid of the old header files anyway.

After installing GNU libc, you may need to remove or rename `/usr/include/linux` and `/usr/include/asm`, and replace them with copies of `include/linux` and `include/asm-$ARCHITECTURE` taken from the Linux source package which supplied kernel headers for building the library. ARCHITECTURE will be the machine architecture for which the library was built, such as ‘`i386`’ or ‘`alpha`’. You do not need to do this if you did not specify an alternate kernel header source using ‘`--with-headers`’. The intent here is that these directories should be copies of, not symlinks to, the kernel headers used to build the library.

Note that `/usr/include/net` and `/usr/include/scsi` should not be symlinks into the kernel sources. GNU libc provides its own versions of these files.

GNU/Linux expects some components of the libc installation to be in `/lib` and some in `/usr/lib`. This is handled automatically if you configure glibc with ‘`--prefix=/usr`’. If you set some other prefix or allow it to default to `/usr/local`, then all the components are installed there.

If you are upgrading from libc5, you need to recompile every shared library on your system against the new library for the sake of new code, but keep the old libraries around for old binaries to use. This is complicated and difficult. Consult the Glibc2 HOWTO at http://www.imaxx.net/~thrytis/glibc for details.

You cannot use `nscd` with 2.0 kernels, due to bugs in the kernel-side thread support. `nscd` happens to hit these bugs particularly hard, but you might have problems with any threaded program.