News for hackers. Stuff that matters.
Re:“Shared libraries are not a good thing in general” by jayd16 on Saturday May 01, 2021 @08:15PM (#27011172)
DLLs and shared libraries are different things though, no? Isn't it common in windows to use DLLs and simply pack in everything you need? Is that not the best of both worlds minus a bit of ram and disk?
Re:“Shared libraries are not a good thing in general” by loeg on Sunday May 02, 2021 @02:07AM (#27012715)
> DLLs and shared libraries are different things though, no?

No; they're just different names for the same concept.

> Isn't it common in windows to use DLLs and simply pack in everything you need?

Yes.

> Is that not the best of both worlds minus a bit of ram and disk?

No; it's more like the worst of both worlds. When it is feasible, static linking is strictly superior to this approach. (You've pointed out that it may not be feasible in some cases in sibling comments, and I agree.)

Re:“Shared libraries are not a good thing in general” by floatboth on Saturday May 01, 2021 @08:23PM (#27011212)
DLLs are the same kind of file as ELF shared objects. Thing is that in Linux/BSD world they are indeed also commonly shared system-wide, on a package management level.

Bundling shared libraries is kinda the worst of both worlds: not getting any sharing between application (/system wide security patches) but not getting the performance benefits of static linking either. The only good thing is that you could manually replace e.g. a vulnerable version of a library inside this bundle.

And yeah… Flatpak/AppImage/snap distribution is kinda like that Windows-style one.

Re:“Shared libraries are not a good thing in general” by hdhrnnrkrkf on Saturday May 01, 2021 @08:52PM (#27011368)
Bundling shared libraries is also used in big apps for faster build times and for more physical separation between modules.

Arguably the final release version could be statically linked, but that could be subtly different than what the devs are using.

Re:“Shared libraries are not a good thing in general” by liuliu on Saturday May 01, 2021 @09:08PM (#27011464)
For these cases, you can just use a modern build system (Bazel) and incremental linker (lld / gold).
Re:“Shared libraries are not a good thing in general” by jayd16 on Saturday May 01, 2021 @09:37PM (#27011628)
Not everyone is in a position to vendor source for all their dependencies and use a new build system to solve a solved problem.
Re:“Shared libraries are not a good thing in general” by jcelerier on Sunday May 02, 2021 @04:22AM (#27013315)
I do the same with good ol' cmake, I have a "developer" preset which will build my app with clang, lld, PCH, split into small shared libraries. And a release preset where everything is statically linked
Re:“Shared libraries are not a good thing in general” by dathinab on Saturday May 01, 2021 @09:44PM (#27011667)
DLL's are the windows version of shared libaries.

Shared Objects (.so) are the Linux version of shared libaries.

I.e. they are an implementation detail, and if you don't use them as "shared library" (in general) then it won't really fall under this category.

Re:“Shared libraries are not a good thing in general” by jayd16 on Saturday May 01, 2021 @11:12PM (#27012067)
Sure but the point is the predominant style on windows is to copy an exclusive version of needed DLLs and not share them.
Re:“Shared libraries are not a good thing in general” by CRConrad on Sunday May 02, 2021 @08:59AM (#27014905)
The now predominant style. Windows DLLs didn't always used to be named Whatever_5_0_1.DLL; used to be it was just Whatever.DLL.

Which lead to "DLL Hell" when the version of Whatever.DLL you had installed was not the same as the developer of your app had so the app wouldn't work, and if you switched to the one he had, some other app that used Whatever.DLL stopped working in stead. Which lead to the "exclusive version" / version-named DLL situation we have on Windows today... And, increasingly, on Linux.

I don't know exactly how shared libraries are loaded -- there are some tantalising mentions in sibling comments -- but it all seems to point towards two opposite solution paths:

1) Version-named libraries like on Windows; and/or, possibly, some file-link magic where /std_shared_libs/somelibrary/somelib_x points to /actual_libs/somelibrary/somelib_x_y_z, etc, etc... Then you could also have .../somelibrary/somelib_latest point to, well, the actual latest version installed, and somelibrary/somelib_default point to the one you want as default, etc, etc. (Hmm... Shouldn't stuff like this have been hammered out decades ago by, Idunno, some kind of Linux standardisation initiative... if this doesn't exist already, then WTF is the LSB for?!?)

2) Just fucking static-link everything already.

Friar William of Ockham seems to be pointing more towards one than the other of the above.

Anyway, what certainly doesn't look like a great solution to me is

3) Containerization. That just feels like "In stead of fixing DLL Hell on Linux, let's just ignore it, replicate ~half the OS -- but with our preferred version of every library -- inside a (pseudo-)VM, and pretend that running boxes within boxes within boxes is a solution". No, that's not a solution, that's a kludge.