LRP uses glibc 2.0.x[1], not glibc 2.1.x or glibc 2.2.x. This is not immediately obvious, but shows up quickly if any programs linked against glibc 2.1 are run under LRP. The results are invariably a segmentation fault. A program must be compiled to use glibc 2.0, not glibc 2.1, if it is to run under current versions of LRP and its derivatives.
Be sure that you get the most current version of the GNU C libraries, whatever version you use; there have been security patches applied to nearly every version. Security problems in glibc affect your entire system; thus, it is important to upgrade as necessary.
Being able to work with static libraries is important, since depending on the library it may or may not be included in the LRP system. For example, the GNU C libraries are included, but the Linux pthreads library is not. Thus, either the Linux pthreads library will have to be statically linked with an executable that requires it or the pthreads library will have to be added to LRP. A static library is one that is included with the resulting executable, thus reducing the need for external libraries.
Static libraries have tradeoffs, however: the size of the executable increases accordingly, since the library is now included in the executable. Another tradeoff is that a statically-linked library may be included on a system multiple times if multiple executables contain it. If a dynamic library is used, it exists only once — but a non-traditional library (such as libpcap.so or libpthreads.so) is then required by the binary to execute, and the error messages resulting from a missing library is not immediately understandable by a non-technical user. The gcc How-To has a valuable description of the linking process, including working with static and dynamic libraries.
To modify a make file to use only specific static libraries (and not create a single statically linked executable), change:
LIBS=-lncurses
to
LIBS=-Wl,-Bstatic -lncurses -Wl,-Bdynamic
Note that that is an ell, not a one, and that the second hyphen (or dash) is required.
To create dynamic libraries where only static libraries exist, use one of the following methods:
Use the linker[2]
ld --whole-archive -shared -Wl,-soname,libfoo.so.1 -o \ libfoo.so.1.o libfoo.a
Use the C compiler
gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o
The former is probably prefered, since it actually uses a static library as its input, not the component object files.
The glibc2 How-To is a valuable information resource; it is at http://tldp.org/HOWTO/Glibc2-HOWTO.html
The gcc How-To is also valuable; it is at http://tldp.org/HOWTO/GCC-HOWTO/index.html
[1] This is changing. The latest Oxygen version uses glibc 2.1.3.
[2] Bill
Suethoz <wsuetholz@centonline.com>
(posting to LRP-dev, 23
October 2000)