Chapter 4. Writing or Compiling Programs for LRP

Table of Contents

Common Problems
LRP and C Libraries
Why Not Use glibc 2.1.x with LRP?
Why Not Use glibc 2.2.x with LRP?
Standard Libraries Included with LRP
Adding Additional Libraries to LRP
Upgrading or Replacing Libraries in LRP
Compiling for LRP
C Libraries and the Linux Kernel
Compiling with Red Hat Linux 6
Compiling for LRP with Any Distribution
Problem Solving
Scenario #1: Echo Security Scanner
Scenario #2: axfer

The easiest way to write programs to work under LRP is to use Debian 2.1 (Slink). This is because of several factors:

However, other systems and Linux distributions can be used. The only requirement is that compiled programs be linked against the GNU 2.0 C libraries, not the more current 2.1 version. This requires special attention and configuration for current Linux distributions.

The gcc How-to is most helpful. It is available at http://tldp.org/HOWTO/GCC-HOWTO/index.html.

Common Problems

Common problems include the following:

  • The standard development environment (Debian 2.1 or Red Hat 5.2) typically uses Linux 2.0; some programs require headers included in Linux 2.2 or better. This can be rectified by upgrading the kernel — usually not a problem.

  • LRP contains glibc 2.0.7; most modern programs are now compiled against glibc 2.1 or glibc 2.2 — much, much bigger libraries. This is a very big problem.

  • Sometimes a program's source relies on definitions found in glibc 2.1 or 2.2 header files but missing in glibc 2.0 header files, or located elsewhere in the glibc 2.0 header files, or defined differently. The worst possible result of this is that the sources cannot be compiled under glibc 2.0. This is the case for the new bridge utilities and others. Fortunately, this drastic result does not happen often.

  • Many networking programs use libpcap (the Packet Capture Library) and look for pcap.h in /usr/include; change the include files to look for pcap.h in /usr/include/pcap — make sure, of course, that you really do have libpcap first.