Static linking considered harmful

Patrice Dumas pertusus at free.fr
Wed Nov 22 10:49:04 UTC 2006


On Wed, Nov 22, 2006 at 05:41:19AM -0500, Jakub Jelinek wrote:
> On Wed, Nov 22, 2006 at 11:24:28AM +0100, Patrice Dumas wrote:
> > Not only. There are cases when all those issues are moot, a prominent one 
> > being for numerical models. Compiling models statically makes it possible
> > to run them on any other linux (including different fedora version) box 
> > without recompiling.
> 
> That's a myth, static linking decreases portability, e.g. because statically
> linked binaries have the dynamic linking code compiled statically into the
> binary, thus they can't deal with new system shared libraries, new iconv
> modules, nss modules, locale data formats, etc.  And, most of statically

That's exactly the point. In that case we don't want to deal with new
system shared libraries, new iconv modules, nss modules, locale data formats, 
etc. In fact this is the reverse, sometimes it is usefull to be able to
rerun old executables to have exact same results for chaotic models, for
example (although I have not myself come accross such cases).

> linked programs touch one of those areas, many functions use nss services,
> stdio uses internally iconv, many functions deal with locales, etc.

That's not true for numerical models. I don't really underestand what you 
are talking about. When I compile  a model with

gcc -static mymodel.o -lnumerical-lib

I don't care at all about system share libraries, this is not a shared 
executable, so no trouble with new system shared libraries. And once more
for numerical models iconv, locales, and nss are not really usefull.

--
Pat




More information about the fedora-devel-list mailing list