So why not just statically link at this point?
So why not just statically link at this point?
In many cases, you just can't. Other than glibc having issues with static linking, you can't use `dlopen` in a static binary.
For example, if you're building an application which can use OpenCL, you need to dynamically link to the ICD installed on the system. And because `dlopen` doesn't work in a static application, you're stuck with dynamic linking the whole application (or at least with libc). On the other hand, Windows has no issue with `LoadLibrary` in a static binary...
I don't know enough about GUI applications, but I wouldn't be surprised if anything needing graphical output is in a similar boat.
The cherry on top is that glibc doesn't make it easy for an application to be built for an older version of the library. As Linus Torvalds can attest to [https://www.youtube.com/watch?v=Pzl1B7nB9Kc] building for Linux sucks.
The best trade-off is probably "link against libc, statically link everything else". That gives you dlopen() and some security benefits. But again, build systems don't support it very well out of the box.
I think the outright hostility against static linking has been unfortunate, because now we have a whole bunch of "static linking, but with extra steps" systems to work around it. Dynamic linking is fine for many things, but it's obviously not always the best solution.
It's disappointing that essentially nothing really improved in the 10 years since Linus gave that talk. Okay, there's flatpak and appimage and snap which are an "improvement" of sorts, but it's all pretty complex and half the time when I wanted to run one it didn't work well.
I'd like to be able to patch SSL bugs without downloading a whole new binary for everything that depends on it. But at the same time, I probably couldn't care less about other dependencies, and I don't want to sort out version mismatches and deal with system libraries in most cases.
Ideally the operating system itself could help manage this. Know what deps I care to handle myself or override.
SDL works like that: https://github.com/libsdl-org/SDL/blob/main/docs/README-dyna...
Also you'd want the basic libraries like glibc, ssl to be provided as shared libraries by the distros for various reasons - including security.
That being said i do appreciate how newer languages like rust, go default to static linking.
While this might be a little more annoying, you can absolutely statically link a proprietary application with an LGPL library. You do need to provide object files for the proprietary bits so someone could relink it with a different/modified version of the LGPL library, though. Which, yes, is annoying to the point that if I were distributing a proprietary application, I probably would use dynamic linking with the LGPL bits.