Static Linking

Julius Schmidt
Tue Feb 22 19:34:00 GMT 2011

> If I had to guess, this change was introduced in cvs/glibc-2_3_3~505
> (nis/nss_compat/compat-*.c: Don't use our own NIS/NIS+ functions,
> dlopen corresponding NSS module instead, 2003-06-26).  Searching
> libc-alpha yields [1] which suggests it was used to make the
> nameservice switch _extensible_: that is, /etc/nsswitch.conf can
> request use of an NSS module that didn't even exist when glibc was
> built.
> And that is just good software engineering practice.
I'd just really like to comment on this (in a sarcastic manner); but
I've got better things to do ....

There seem to be some other functions (dlopen, ...); is there a
comprehensive list? I don't think --enable-static-nss fixes all of them,
does it?

> Now that is a separate question.  I believe you can get most of
> the benefits of static linking by linking statically to everything
> _except_ libraries like libc; libc has a very stable ABI so linking
> dynamically to it is just as good (better, actually) if you are
> careful about not linking to too-new symbols.
Is there some recipe how to be careful about this?

> See also "2.22. Even statically linked programs need some shared
> libraries" in the glibc FAQ.
Thanks, I really should have checked.


More information about the Libc-help mailing list