Static vs Dynamic Linking

The cluster debates the advantages and disadvantages of static versus dynamic linking, particularly focusing on security vulnerabilities and the ease of applying patches to shared libraries in dynamic linking without recompiling applications.

📉 Falling 0.3x Security
2,366
Comments
20
Years Active
5
Top Authors
#3196
Topic ID

Activity Over Time

2007
1
2008
5
2009
9
2010
44
2011
30
2012
64
2013
82
2014
92
2015
142
2016
158
2017
98
2018
147
2019
134
2020
248
2021
347
2022
208
2023
184
2024
243
2025
120
2026
10

Keywords

e.g IMO AppImage TBH IF EDIT E.g PKCS package.json ABI libraries library linking update statically dynamic security openssl static version

Sample Comments

takeda May 2, 2021 View on HN

You're forgetting about one common case where libraries are replaced.This is security vulnerabilities. If your application depends on a common library that had a vulnerability, I can fix it without you having to recompile your app.With GLibc or X libraries a vulnerability there would result essentially requiring reinstallation of the entire OS.

goodpoint May 2, 2021 View on HN

Linux distribution fix vulnerabilities in shared libraries all the time.Imagine statically linking openssl having to rebuild tenths of thousands of packages every time there's an update!

e12e Apr 12, 2014 View on HN

I don't think it's so much how you (as an active developer does it) -- granted having to redistribute your app everytime any of (say) 10 bundled dependencies need an update is an inconvenience -- the biggest problem is when you have some old software (without vendor support) that is statically built with some overflow "built in" from an old version of a library.Granted, at some point patches probably won't be backported, but it is convenient to be able to upgra

caspper69 Feb 13, 2025 View on HN

Your complaint is more related to how the OS you're running on handles dynamic libraries, rather than anything inherent to dynamic libraries themselves. It is possible to version libraries and serve up the correct version(s) to different applications simultaneously.Now, consider the case of a Linux distro with a few thousand binaries. Should a defect be found in a common library, the burden of updating, say, 10,000 servers might rapidly become a headache. In this case, a shared library p

JupiterMoon Feb 24, 2016 View on HN

Static linking would solve this. You end up with a bigger application and have to do updates every time a library needs a security patch. But you have this anyway if e.g. you release a python application on Windows.

weland May 30, 2015 View on HN

This is certainly very true, and the pessimistic tone of the cat-v article is, to some degree, unwarranted, but it's also worth pointing out the unanticipated problems real life brought.In practice, this is something that happens less often than we'd want:> It's the last that is still crucial and which causes so many problems. When, say, there's a security problem in Webkit, an updated version of the webkit code can be installed, immediately (well, upon restar

pedrocr Oct 23, 2009 View on HN

There are clearly downsides to dynamic linking but static linking would fail spectacularly when there is a bug in a common library, like libc. One of two things happens:- Some applications are not updated and retain the bug. Extremely dangerous if it is a security bug.- Suddenly your package manager needs to update almost every single application on your system. All the packages in my Ubuntu system is a total of ~1GB. Now that you statically compiled them prepare for a very long download.<

tutfbhuf Mar 27, 2024 View on HN

One issue with static linking is that your dependencies will likely have critical CVEs over time. If you keep all your libraries separate on the filesystem, you can just do a "apt update; apt upgrade", and you will have all the latest patches. This will patch security issues in e.g. libssl or libc for all your applications that are dynamically linked against this shared libraries, which can be quite a few. In static binaries, the version of the libraries is not obvious from the outside

rektide Apr 6, 2023 View on HN

There's also the issue that if a library has a vulnerability, you are now reliant on every static binary updating with the fix & releasing a new version.Where-as with the conventional dynamic library world one would just update openssl or whomever & keep going. Or if someone wanted to shim in an alternate but compatible library, one could. I personally never saw the binary compatibility issue as very big, and generally felt like there was a while where folks were getting good at

chmike Feb 29, 2016 View on HN

Wouldn't this raise the issue of application updates ? If the app imports its own libraries, who will take care to update them if a security issue is detected ? That's the point to enforce using shared libraries on unix system.