I can't even remember how many hours I wasted on trying to compile a new version of some program, just to learn the infinite tree of dependencies, newer versions of existing libraries required, build prefixes tweaking etc... Most of that time could have been saved.
* increased storage space
* increased memory usage
* increased downtime for updates (since more files have
to be updated)
* increased bandwidth usage (total size of download
for update)
* potentially increased security risks
In short, trading off all of the above to simply avoid proper release engineering and simplified dependency management is the wrong answer.Our systems need less downtime and better security; not the opposite, which is what static linking brings.
That's why Solaris, as an example, does not provide static archives for almost any of the components that are provided, especially libc.
it will decrease memory usage (as most loaders load the whole library, even when just one function is used)
more things to upgrade, yes
more bandwidth, yes (not much if one uses binary diffs)
potentially increased security risks, yes. although shared libraries are bigger security risks
i made an acc just to reply to this. why do people never understand static linking ?
Most OS linkers already do efficient loading of only the relevant portions of a shared library since they typically mmap the library file.
In aggregate, static linking the same dependency for multiple programs will increase memory usage as well despite your assertions to the contrary since the pages will not generally be shared (yes, I'm aware some OS have page dedup or compression, etc., but I'm talking about the general case here).
more things to upgrade, yes more bandwidth, yes (not much if one uses binary diffs)
A binary diff of 100 programs all linking to the same library will still be larger than the diffs for a single library.
In addition, updating 100 binaries, even with diffs still takes longer than uprating a single library, which means increased downtime during system updates.
potentially increased security risks, yes. although shared libraries are bigger security risks
Code is code; how is shared linking a greater risk? Have any data to back that up?
i made an acc just to reply to this. why do people never understand static linking ?
I understand static linking quite well, since my day job is part of a commercial OS team that coincidentally pioneered dynamic linking technology in UNIX.
So let's not base our arguments on assumptions about knowledge just because we disagree.
a page is 4kB (on x86 at least). a function is typically, what, 60 bytes ? 120 maybe ? 240 ? some functions use other functions (fopen()->_open() in libc) so you can have more then two pages
maybe you are thinking about swapping (or not even lazy loading in the block layer) ? code has to be in RAM, everything else is insecure
>In aggregate, static linking the same dependency for multiple programs will increase memory usage as well despite your assertions to the contrary since the pages will not generally be shared (yes, I'm aware some OS have page dedup or compression, etc., but I'm talking about the general case here).
not pages, functions (and/or variable objects). when you make a .la on unices you are making a ar(1) archive out of .o object files. when the linker is linking the final binary it opens that .la archive and pulls out the relevant .o objects
so "statically linking to properly(!) made libraries" will reduce overall memory usage, unless a lot of programs use that (small) library (rarely the case)
OSX linker does the right thing with their libc. in that out of the many optimized memcpy()'s it will only load the one that is fast on the particular cpu
GNU linker loads them all
>Code is code; how is shared linking a greater risk? Have any data to back that up?
data to back it up ? do you have any data to back up anything you said ?
LD_PRELOAD can be used to replace functions and the user/admin would not notice it. while the only security flaw with static linking is an administrative mistake
>I understand static linking quite well, since my day job is part of a commercial OS team that coincidentally pioneered dynamic linking technology in UNIX.
>So let's not base our arguments on assumptions about knowledge just because we disagree.
so go ask them about it
But in the situation that a new version of the software is released, and I think it would benefit me right now, I'd trade all those downsides for being able to use that software right now than waiting to be included in my distro (like it happened to me with Gimp some years ago).
I'm plenty of memory, storage and bandwidth but not so much of time to compile it by hand.
I have to admit that this is just a workaround while we find a better software release and dependency management system.
I don't understand what static linking vs. dynamic linking has to do with waiting for gimp to be included in your distro?
I'm plenty of memory, storage and bandwidth but not so much of time to compile it by hand.
No one is suggesting you have to do that, but someone will have to do that, and it does require resources (time, people, hardware, etc.).
I have to admit that this is just a workaround while we find a better software release and dependency management system.
If by system, you're referring to technology, then I disagree.
In other words, the technological constraints of today's package management systems are not the primary issue, rather it is how the software itself is being developed and managed and the available resources to do so.
Ultimately though, most of this all comes about because the underlying systems that applications depend upon in a typical Linux distribution are not properly release engineered. They don't properly version the shared libraries, they don't carefully avoid incompatible changes in interfaces, and they don't have sufficient regression testing.
So to me, the right answer is to fix the root of the problem, not paper over it by pretending there isn't one by essentially embedding copies of every dependency into an application.
In short, start encouraging developers to reduce their dependency chains, properly release manage their software, ensure that core system components offer stable interfaces, and provide timely updates.
Whereas with static linking, you can directly see the effect that any library you use has on the binary size. This encourages library and application devs alike to be more judicious with their dependencies.
Architecting an operating system and its packages as a psychological forcing function to improve software development is not a worthwhile tradeoff for the efficiency, security, or reliability of a system.
Who cares about 20 megs here or there if there is only one shared library instance? Who cares about bringing in a tree of 50 dependencies for this console program if the user probably has them installed already? And thus we end up with the modern Linux desktop, where nearly everything depends on a gigabyte or more of dependencies.
I find it amusing that someone is arguing for static linking as a way to make it obvious how bloated programs are, since usually the counter-argument to dynamic linking from many is "who cares about disk space!".
There are plenty of programs that are distributed essentially statically-linked today, that still have 50 dependencies or more -- there is no data that I am aware of to support the idea that dynamic vs. static linking would encourage developers to reduce their dependencies.
Whereas with static linking, you can directly see the effect that any library you use has on the binary size. This encourages library and application devs alike to be more judicious with their dependencies.
This is a dubious argument at best; you can still easily see the size of your program today even if it's dynamically linked simply by looking at top, or by using the appropriate developer tools.
I can empathize with the frustrations that some feel in dealing with some operating systems and applications, but it is not due to a technological issue -- it is due to cultural and process issues present not only in the development of the software they rely on but in the distributions that provide the software themselves.
"papering over" those issues by static linking only makes the problem worse -- not better. This a cultural and process issue that cannot be addressed solely through technological means.
Also, I want to be clear that I am not linking against static linking completely; I'm arguing for dynamic linking (or more generally, shared objects) for those dependencies shared between a sufficient number of components that have sufficiently stable interfaces to share them.
By all means, if there is a component with a sufficiently unstable interface, then by definition, it is not appropriate for sharing between components, and at that point whether you statically or dynamically-link the dependency is moot, since you can have private dynamically-linked dependencies just as easily statically-linking them into binaries.
Software is just files on disk, rather than statically linking (and this duplicating) to libraries we can use references to the libraries (dynamic linking), the issue is the user has to install the software and its dependencies then.
AppFS solves this by not having an install step. All files in all AppFS packages in all the world show up in the filesystem if you look for them. They are then cached to disk if you try to use them.
So if you had a package X that depended on library Y you simply run the binary you want from X and any libraries from Y will get used.
Since AppFS is a global namespace using HTTP, it has very similar semantics to the WWW, just with symlinks or ELF NEEDED entries instead of hyperlinks.
So you, as a developer can publish software that depends on the software another developer publishes, and the user can fetch the software directly from you without there ever being an install step.
In reality that of course doesn't happen, so programs linking statically or including their own versions of shared libraries never get security updates for the included libraries.
A couple of years back Microsoft discovered some kind of issue with their redistributable dlls.
They patched Office etc, but could only offer a scanner that would check each and every dll to see if it was of a vulnerable version. And asked users to pester third party software providers for updates if the scanner found any.
New versions of software also fix old stability and security bugs.
If software became more secure with age, then the older your version of gnome screensaver, the more secure it would be ( https://www.jwz.org/blog/2015/04/i-told-you-so-again/ ).
Sometimes new versions of software fix bugs, sometimes they improve stability, sometimes they introduce new bugs, sometimes they decrease the performance, sometimes they become bloatware, sometimes several of this things happen in any combination.
Debian guarantees that when you install their distro things are going to work and are kind of secure. The tradeoff of having all the software in the distro being checked by people that have tested and checked that everything works well and smooth it's going delay updating the packages.
But the idea of having a distro it's something that offers you that. That someone took the work of packaging and testing, so you can install things and everything works.
I think that if more software would be offered statically compiled with all the libraries (like many apps in OSX), then we would be able to try the latest release of Gimp when it's released, instead of having to waste time trying to compile from source or waiting for being included in the next release of the distro.