Securing-Optimizing-RH-Linux-1_2_150
Comments and suggestions concerning this book should be mailed to gmourani@videotron.ca
© Copyright 1999-2000 Gerhard Mourani and Open Network Architecture ®
150
One-file programs are quite rare. Usually there are a number of files (say *.c) that are each
compiled into object files (*.o) and then linked into an executable. The compiler is usually used to
perform the linking and calls the 'ld' program behind the scenes.
The Makefiles
The Makefiles are intended to aid you build your program the same way each time. They also
often help with speed. The make program uses dependencies in the Makefile to decide what
parts of the program need to be recompiled. If you change one source file out of fifty you hope to
get away with one compile and one link step, instead of starting from scratch.
The Libraries
Programs can be linked not only to object files (*.o) but also to libraries that are collections of
object files. There are two forms of linking to libraries: static where the code goes in the
executable file and dynamic where the code is collected when the program starts to run.
The Patches
It was common before for executable files to be given corrections without recompiling them. Now
this practice died out. In modern days, people changes a small proportion of the whole source
code, putting a change into files named patch. Where different versions of a program are
required small changes to code can be released, saving the trouble of having two large
distributions.
The Errors in Compilation and Linking
Errors in compilation and linking are often typos, omissions, and misuse of the language. Checks
that the right includes files are used for the functions you are calling. Unreferenced symbols are
the sign of an incomplete link step. Also checks if the necessary development libraries (GLIBC) or
tools (GCC, DEV86, AUTOMAKE, etc) are installed on your system.
The Debugging
Debugging is a large topic. It usually helps to have statements in the code that inform you of what
is happening. To avoid drowning in output you might sometimes get them to print out only the first
3 passes in a loop. Checking that variables have passed correctly between modules often helps.
Get familiar with your debugging tools.
Build and Install software on your system
You will see from chapter 10 through chapter 20 bellow that we use many different compile
commands to build and install programs on the server. These commands are UNIX compatible
and are used on all variant off *nix machines to compile and install software.
The procedures to compile and install tarballs software on you server follow:
1. First of all you must download the tarball from your trusted software archive site. Usually
from the main site of the software you hope to install.
2. After downloading the tarball, change to the /var/tmp/ directory (note that other paths
are possible) and untar the archive by typing commands (as root) as in the following
example:
[root@deep /]# tar xzpf foo.tar.gz
The above command will extract all files from the example foo.tar.gz compressed archive and
will create a new directory that will handle all his files with the name of this software from the
place where you are executing the command.
The x option tells tar to extract all files from the archive.