[CentOS] Static linking against glibc

Mon Jun 25 12:39:05 UTC 2007
Anand Buddhdev <anandb at ripe.net>

I'm building an RPM of a DNS server called NSD on CentOS 4.4. I'm going to 
be using it for some heavy-duty DNS traffic, so I want to minimise its 
dependencies on external libraries. I have therefore attempted to link it 
statically.

The package does build, and even runs fine. However, during the build 
process, gcc emits warnings like these:

nsd.o(.text+0xfba): In function `main':
: warning: Using 'getpwnam' in statically linked applications requires at 
runtime the shared libraries from the glibc version used for linking

My understanding of this is because glibc uses dlopen to load other shared 
objects at runtime. I therefore need a Requires: line in the RPM which 
requires glibc-2.3.4-2.36, or whatever version I used to build nsd.

Now, what I want to ask is: if the version of glibc is upgraded to say 
2.3.4-2.48, what happens? What do the numbers after the version number 
mean (2.48) and what effect will that have on packages which are 
statically linked against glibc?

Another question which has occured to me is this: NSD also uses other 
libraries, such as openssl. Is there any way to know if any of the 
openssl libraries use dlopen to load in other shared objects? If they do, 
then it introduces dependencies that I may not be aware of, and doing 
static linking wouldn't be as beneficial as I first thought it would be.

Comments from experienced developers will be most appreciated.

-- 
Anand Buddhdev