Static linking considered harmful

Nicholas Miell nmiell at comcast.net
Thu Nov 23 02:04:45 UTC 2006


On Wed, 2006-11-22 at 16:33 -0800, Ulrich Drepper wrote:
> Japheth J.C. Cleaver wrote:
> > I don't see how the first two paragraphs here comport with the remaining
> > ones. If people are going to be able to compile things statically then
> > they need to be able to.
> 
> The first paragraph is about linking the code which comes from your 
> package statically.  I.e., only link those libraries statically and 
> everything else dynamic.  Static linking is no all-or-nothing decision 
> in case you didn't know.
> 
> 
> > (Our mail server saw a
> > performance boost of about 20% when we statically linked our process chain.)
> 
> I *very* much doubt those numbers.  Using PIC and the runtime linker 
> does not add that much overhead.  Never has, never will.  If you compare 
> apples and oranges you can come up with such numbers, of course.
> 
> 
> > We should not remove the ability to easily install static libraries from
> > the Fedora/Fedora-Extras system simply due to someone's crusade against
> > it. If a Fedora user is to be trusted with Development Packages, then
> > they should be trusted to "know what they're doing" wrt dynamic vs.
> > static linking.
> 
> No.  And it can be proved easily: name all the libraries used in all the 
> builds of the statically linked apps.  And automate rebuilding when any 
> of those changes.  Fact is, nobody does this.  Only through dynamic 
> linking can you take immediately advantage of the new builds.

Some misguided folk are still trying, though. The most recent example I
can think of is OpenPKG wanting support for this in RPM.
See: http://article.gmane.org/gmane.linux.redhat.rpm.devel/1695


> And this is not "someone", it's everybody who understand a bit about 
> this.  And it's not just Fedora or Red Hat, not even only Linux. 
> Solaris is also pushing hard to eradicate static linking with system 
> libraries.

They've been eliminated entirely as of Solaris 10. A explanation why is
here: http://blogs.sun.com/rie/entry/static_linking_where_did_it

Unsurprisingly, it repeats much of what has been said in this thread
already.

-- 
Nicholas Miell <nmiell at comcast.net>




More information about the fedora-devel-list mailing list