Compiling for LRP

Compiling source files for LRP requires making gcc use version 2.0.x of the C libraries. If the system comes with this version (as Debian 2.1 and Red Hat 5.2 do) then nothing more is required. More recent Linux distributions use version 2.1.x.

To force gcc to compile against an installed 2.0.x C library instead of a resident 2.1 (or later) C library, the linking process needs to be adjusted. Section 6 (Compiling with the non-primary libc) of the glibc2 How-To is most helpful here. Here is the process as described (abbreviated):

  1. Set new options for gcc:

    -nostdinc                                          no standard includes
    -I/usr/i486-linuxglibc2/include                    glibc include files
    -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2        gcc include files
  2. Set new options for the linker:

    -b i486-linuxglibc2                                gcc include files

The appropriate gcc invocation would be:

gcc -b i486-linuxglibc2 \
-nostdinc -I/usr/i486-linuxglibc2/include \
-I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include "$@"

This assumes that the appropriate directories are used in place of i486-linuxglibc2.