Andrew Haley wrote:
Kai Ruottu writes:
> Maybe Mr.Drepper isn't so proud about the static-linking properties
> with glibc?
I find this prospect to be exceedingly unlikely. I have no idea why
you might think so.
I remember once comparing statically linked apps for SCO Unix 3.2,
Novell UniWare 1.1, some FreeBSD and OpenBSD versions, and for Linux
with glibc-2.2.5. And there was that 1:10 difference in size between
the old world with little memory available and the new "who really
cares about any memory use nowadays" world Linux presents. So a new
check for this maybe was motivated. Trying three current in-use target
systems, UnixWare 7.1.4, Red Hat 7.3 and SuSE 10.1 gave :
kai@Dell:/data1/home/kai-old/test/tprintf> size tst_uw7.1.x tst_rhl7.3.x
tst_suse10.1.x
text data bss dec hex filename
37645 1785 372 39802 9b7a tst_uw7.1.x
359738 10000 3904 373642 5b38a tst_rhl7.3.x
453332 2056 6848 462236 70d9c tst_suse10.1.x
kai@Dell:/data1/home/kai-old/test/tprintf> file tst_uw7.1.x tst_rhl7.3.x
tst_suse10.1.x
tst_uw7.1.x: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), statically linked, stripped
tst_rhl7.3.x: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), for GNU/Linux 2.2.5, statically linked, for GNU/Linux 2.2.5,
stripped
tst_suse10.1.x: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), for GNU/Linux 2.6.4, statically linked, for GNU/Linux 2.6.4,
stripped
The old COFF-using SCO SVR3.2 produced an executable which was less than
20 kbytes in size, the *BSD systems something between 20 and 30 kB...
The bare objects produced from the same code with the same GCC version
were quite identical in size, so the rest "code bloat" comes from the
C libraries when linking against them.
I still wouldn't recommend anyone to link statically anything, so the
"who cares" attitude is my thought, normal dynamically linked apps
should work when produced somehow sanely. The OpenOffice and Mozilla
people could say much more about these compatability things, I don't
expect there being much statically linked apps in their "for Linux"
binaries...
Old Unices using COFF usually used only statically linked apps but with
ELF the shared libraries became available, so why not use them? One can
of course wonder why those small statically linked apps are now so big,
but does it really matter when nobody should produce them?
Or maybe should, one day again some clever idiot manages to delete the
'/libc.so.6' etc. and expects then being capable at least to use 'cp'
for copying the stuff back, or use 'rpm' etc., so at least some very
important programs in Linux must still be statically linked or how? I
think myself being this kind of clever idiot at least once and having
somehow deleted one or more important runtime libraries as 'root' or
only the symlinks to them (my own stupidity) because then not yet
knowing what the "delete a symlink and then replace it with another"
could cause. So those who are producing "idiot-proof" base Linux tools,
are those who could choose to use statically linked "stand-alone"
executables.