News for hackers. Stuff that matters.
Re:Oasis: a small statically-linked Linux system by Subsentient on Tuesday December 01, 2020 @10:59AM (#25266274)
Honestly, I'm team dynamic linking. I prefer to have things clearly separated in functionality and easily upgradeable.

Statically linking all the OS utilities to their dependency libraries, over and over again? Dear god that sounds awful.

Re:Oasis: a small statically-linked Linux system by AnIdiotOnTheNet on Tuesday December 01, 2020 @11:11AM (#25266425)
There's no reason that there needs to be such extremes as either all statically linked or all dynamically linked. History has proven that dynamic linking causes a large number of headaches, and static linking has drawbacks as well. There is a reasonable middle ground: base system functionality that is utilized by most software (stdlib, cryptography, networking, gui, etc) should be dynamic and everything else should be static.

The problem is that Linux userspace has historically payed little attention to backwards compatibility and has no definition of "base system". Consequently, Linux distros tend to be their own little mutually-incompatible worlds where you either play with the package manager/repo combo you have or jump through hoops and dodge conflicts to try to get anything to work.

Oasis is interesting in this way: there are no conflicts, there is no package manager, and the binaries should work anywhere provided the arch is the same.

Re:Oasis: a small statically-linked Linux system by Subsentient on Tuesday December 01, 2020 @01:21PM (#25268031)
>>There is a reasonable middle ground: base system functionality that is utilized by most software (stdlib, cryptography, networking, gui, etc) should be dynamic and everything else should be static

I disagree, I tend to want the opposite. I want big, bloated libraries like Qt or Gtk or Boost to be dynamically linked, and OS facilities like libc to be statically linked.

Re:Oasis: a small statically-linked Linux system by AnIdiotOnTheNet on Tuesday December 01, 2020 @01:42PM (#25268309)
> I want big, bloated libraries like Qt or Gtk or Boost to be dynamically linked

These fall under "GUI" in the "base system" category in my opinion.

> and OS facilities like libc to be statically linked.

If you're not being sarcastic right now, I'm really curious as to your reasoning.

Re:Oasis: a small statically-linked Linux system by zik on Tuesday December 01, 2020 @07:19PM (#25271831)
I'm not OP but statically linking a compact libc like musl gets you just the parts of libc that you need and nothing more. This can be a lot more efficient than a dynamically linked program which has to bring in the entire bloated mess of glibc.

Whether this is a benefit when you're duplicating bits of libc across every executable in your entire system is unclear to me though.

Re:Oasis: a small statically-linked Linux system by Subsentient on Saturday December 05, 2020 @09:27PM (#25320480)
libc is much smaller than other libraries, and as another has pointed out, compiling it statically will get you only the symbols you actually use, so it doesn't even equal the total size of libc. Which makes more sense? Bloating your executable with ~100+MiB of Qt crap, or bloating it with 100KiB of libc symbols?
Re:Oasis: a small statically-linked Linux system by nycticorax on Tuesday December 01, 2020 @03:35PM (#25269545)
This 'middle ground' you describe is essentially how macOS and Windows work, isn't it?
Re:Oasis: a small statically-linked Linux system by Wowfunhappy on Tuesday December 01, 2020 @11:35AM (#25266704)
> There is a reasonable middle ground: base system functionality that is utilized by most software (stdlib, cryptography, networking, gui, etc) should be dynamic and everything else should be static.

But isn't this the exact opposite of what Oasis provides?

Re:Oasis: a small statically-linked Linux system by AnIdiotOnTheNet on Tuesday December 01, 2020 @12:11PM (#25267146)
Oasis is just the opposite extreme of how most Linux distros work. That's interesting because no one else does it. I did not say it was the ideal.
Re:Oasis: a small statically-linked Linux system by abainbridge on Tuesday December 01, 2020 @11:35AM (#25266699)
> I prefer to have things clearly separated in functionality and easily upgradeable.

What is your thinking here? Are you talking about a use case where you have an application that uses a library and a bug fix is issued for that library, so you want to just get the new .so for the library and have the application use it? That feels like a niche use case to me. Maybe there is another benefit, or this use case is more common than I realize. I'd be interested in further opinions/info.

Re:Oasis: a small statically-linked Linux system by bityard on Tuesday December 01, 2020 @12:24PM (#25267321)
> That feels like a niche use case to me.

I wouldn't call it a niche use case at all, it's exactly how the software for all major Linux and BSD operating systems are packaged and built.

For example, when (not if) a vulnerability is found in OpenSSL, package maintainers just commit an update to the openssl package and users only have to download and install one package to patch their system against the vulnerability.

Contrast with a fully-static OS and applications: the maintainers would have to update the openssl package, rebuild it, and then also rebuild _every single other program_ that relies on it as well. On my system, that's 123 packages. I don't have all of those installed, but as a user, it means I would have to download new full copies of around a dozen packages to patch one flaw in one package.

And of course, the packages themselves are much _much_ larger too. Most software that I can install as a flatpack or appimage are at least an order of magnitude larger than the deb version, take longer to start, and also take up more valuable RAM when running.

Proponents of static linking have generally experienced the pain of dynamically-linked software either through container deployment or by accidentally messing up their system with third-party packages and repos and the like. I get it, I have been there too. But even through managing a dynamically linked system is certainly more complex, it brings a lot of benefits to the table.

Re:Oasis: a small statically-linked Linux system by jcelerier on Tuesday December 01, 2020 @01:11PM (#25267902)
> I wouldn't call it a niche use case at all, it's exactly how the software for all major Linux and BSD operating systems are packaged and built.

even though I'm typing this on a linux desktop, this is a niche use case. In Windows, macOS, iOS and Android, so 99.9% of all user-facing computing, all the libraries except the OS API are duplicated for each app.

Re:Oasis: a small statically-linked Linux system by tonyedgecombe on Tuesday December 01, 2020 @04:35PM (#25270257)
I think the license for the Microsoft C runtime dll's precludes bundling although it does allow static linking. It used to cause me no end of problems because the silent install would often fail.
Re:Oasis: a small statically-linked Linux system by eeZah7Ux on Tuesday December 01, 2020 @08:24PM (#25272249)
Updating OpenSSL or any other shared library is a "niche use case"?
Re:Oasis: a small statically-linked Linux system by jcelerier on Wednesday December 02, 2020 @03:39AM (#25274451)
Using OpenSSL is itself a niche on windows / macOS. And it's not about using shared libraries - it's about actually sharing them. I have at least two dozens apps using Qt on my windows desktop but they all use a slightly different or patched Qt version so exactly nothing is gained when compared to static linking
Re:Oasis: a small statically-linked Linux system by mleonhard on Tuesday December 01, 2020 @09:56PM (#25272772)
When you rebuild the binaries that depend on the upgraded library, you can also run their tests and run automated analysis tools. This improves reliability.

DLL loading is full of security risks. Static binaries are free of them.

DLLs are compiled separately from the binaries that load them. Compilers cannot optimize code that calls into a DLL. Compiler optimizers are amazing these days. Compared to a separately optimized binary + DLL, a completely optimized binary will consume less CPU, use less memory, and cause less heap pressure and fragmentation.

DLL's original purpose is reducing memory and disk usage. Since we have different needs now, DLLs are just technical debt.

Re:Oasis: a small statically-linked Linux system by anthk on Saturday December 05, 2020 @11:51AM (#25315953)
I remember statically linked software on Linux (old one, such as Netscape, Soffice)... much faster on usage than LibreOffice today.

Also, on services you got a performance boost.

Re:Oasis: a small statically-linked Linux system by abainbridge on Tuesday December 01, 2020 @12:59PM (#25267764)
OK, that makes sense. I error in my head was imagining a situation where the user was responsible for knowing which openssl .so file to download and where to put it.
Re:Oasis: a small statically-linked Linux system by cestith on Tuesday December 01, 2020 @12:16PM (#25267203)
That is not at al a niche use case, at least on a general-purpose system. Shared libraries on Linux, like most modern OSes, are also shared in resident memory among programs using them. For very common libraries like TLS, readline, or GTK that can be a big savings.
Re:Oasis: a small statically-linked Linux system by mforney on Tuesday December 01, 2020 @02:22PM (#25268771)
> Statically linking all the OS utilities to their dependency libraries, over and over again? Dear god that sounds awful.

Just curious, why does that sound awful to you? Are you worried that it will take a long time to relink the binaries? The oasis build system is incremental, so updates to a library only involve relinking dependent binaries, which is quite fast. Even a full rebuild from scratch only takes a few minutes (assuming you have the sources downloaded already).

If it's just the idea of relinking all the dependencies over and over again, note that with dynamic linking you do this at runtime every time you execute a binary.

Re:Oasis: a small statically-linked Linux system by qwerty456127 on Tuesday December 01, 2020 @07:42PM (#25272018)
> Honestly, I'm team dynamic linking. I prefer to have things clearly separated in functionality and easily upgradeable.

This is awesome as long as no app you need requires an otherwise-useless yet big thing (with its own requirements) or insists on an obsolete version of a library you prefer to have a newer version of.

Re:Oasis: a small statically-linked Linux system by cestith on Tuesday December 01, 2020 @12:14PM (#25267181)
For a system I'm going to keep and use in multiple ways, dynamic linking is wonderful. Save time building and upgrading, and save memory using the various apps.

For a base image for VMs or containers I'm going to build automatically and throw away on demand anyway, a slightly longer build time to statically link things won't hurt. The memory utilization penalty should also be small, because those should only be running one application or a couple at most.