Static linking considered harmful
Jakub Jelinek
jakub at redhat.com
Wed Nov 22 19:25:26 UTC 2006
On Wed, Nov 22, 2006 at 10:38:01AM -0800, John Reiser wrote:
> Jakub Jelinek wrote:
> > If you want bit-reproduceable results, you can equally well
> > just stick the shared libraries you need into the same directory as the
> > program and run it as
> > ./ld-linux*.so.2 --library-path . ./the_numerical_program arguments
> > it will cost you just a few extra lines in the Makefile, IMHO not a big
> > deal.
>
> Yes, the primary outputs will be the same. But the total user interface
> will be different. The process name (revealed by ps, top, etc.) will be
> ld-linux*.so.2 instead of the_numerical_program. So existing scripts
> that monitor (or get out of the way of) the_numerical_program won't find it;
> killall won't work; oprofile will group all such programs together
> as ld-linux instead of as separate numerical programs, etc. This
> "other stuff" is important to users and administrators.
So you link with -Wl,--dynamic-linker,./ld-linux.so.2,-rpath,'${ORIGIN}/lib'
or something similar, that's an implementation detail.
Jakub
More information about the fedora-devel-list
mailing list