News for hackers. Stuff that matters.
Re:Zig cc: A drop-in replacement for GCC/Clang by otterley on Tuesday March 24, 2020 @06:45PM (#22679887)
I would have agreed with this statement about five years ago. (Even though you would have had to restart all the dependent binaries after updating the shared libs.)

Today, with containers becoming increasingly the de facto means of deploying software, it's not so important anymore. The upgrade process is now: (1) build an updated image; (2) upgrade your deployment manifest; (3) upload your manifest to your control plane. The control plane manages the rest.

The other reason to use shared libs is for memory conservation, but except on the smallest devices, I'm not sure the average person cares about conserving a few MB of memory on 4GB+ machines anymore.

Re:Zig cc: A drop-in replacement for GCC/Clang by GordonS on Tuesday March 24, 2020 @07:17PM (#22680099)
> Today, with containers becoming increasingly the de facto means of deploying software

I think that's something of an exaggeration.

Yes, containers are popular for server software, but even then it's a huge stretch to claim they are becoming de facto.

Re:Zig cc: A drop-in replacement for GCC/Clang by mikepurvis on Tuesday March 24, 2020 @08:32PM (#22680690)
App bundles on MacOS and iOS are basically big containers, though there is some limited external linking through Apple's frameworks scheme.

And obviously video game distribution has looked like this since basically forever as well.

Re:Zig cc: A drop-in replacement for GCC/Clang by saagarjha on Tuesday March 24, 2020 @09:46PM (#22681228)
> App bundles on MacOS and iOS are basically big containers, though there is some limited external linking through Apple's frameworks scheme.

There's a file hundreds of megabytes large containing all the dynamically-linked system libraries on iOS to make your apps work.

Re:Zig cc: A drop-in replacement for GCC/Clang by jfkebwjsbx on Wednesday March 25, 2020 @03:58AM (#22682759)
Video games do not run on/as containers. Quite the opposite, in fact.
Re:Zig cc: A drop-in replacement for GCC/Clang by yellowapple on Wednesday March 25, 2020 @11:17AM (#22685363)
In addition to pjmlp's list, Steam is pushing toward this for Linux games (and one could argue that Steam has been this for as long as it's been available on Linux, given that it maintains its own runtime specifically so that games don't have to take distro-specific quirks into account).

Beyond containers / isolated runtime environments, the parent comment is correct about games (specifically of the console variety) being historically nearly-always statically-linked never-updated monoliths (which is how I interpreted that comment). "Patching" a game after-the-fact was effectively unheard of until around the time of the PS3 / Xbox 360 / Wii (when Internet connectivity became more of a norm for game consoles), with the sole exception of perhaps releasing a new edition of it entirely (which would have little to no impact on the copies already sold).

Re:Zig cc: A drop-in replacement for GCC/Clang by pjmlp on Wednesday March 25, 2020 @05:26AM (#22683094)
Kind of.

They do on XBox, Swift, iOS, Android sandboxes.

Re:Zig cc: A drop-in replacement for GCC/Clang by rumanator on Tuesday March 24, 2020 @07:08PM (#22680031)
> Today, with containers becoming increasingly the de facto means

This assertion makes no sense at all and entirely misses the whole point of shared/dynamic libraries. It's like a buzzword is a magic spell that makes some people forget the entire history and design requirements up to that very moment.

Re:Zig cc: A drop-in replacement for GCC/Clang by ithkuil on Wednesday March 25, 2020 @03:46AM (#22682714)
Sometimes buzzwords make sense, in the right context. This was the right context.

Assuming you use containers, you're likely to not log into them and keep them up to date and secure by running apt-get upgrade.

The most common workflow is indeed: build your software in your CI system, in the last step create a container with your software and its dependencies. Then update your deployment with a new version of the whole image.

A container image is for all intents and purposes the new "static binary".

Yes, technically you can look inside it, yes technically you can (and you do) use dynamic linking inside the container itself.

But as long as the workflow is the one depicted above, the environment no longer has the requirements that led to the design of dynamic linking.

It's possible to have alternative workflows for building containers: you could fiddle with layers and swap an updated base OS under a layer containing your compiled application. I don't how common is that, but I'm sure somebody will want/have to do it.

It all boils down to whether developers still maintain control over the full deployment pipeline as containers penetrate the enterprises (i.e. whether re retain the "shift to the left", another buzzword for you).

Containers are not just a technical solution, they are the embodiment of the desire of developers to free themselves from the tyranny of filing tickets and waiting days to deploy their apps. But that leaves the security departments in enterprises understandably worried as most of those developers are focused on shipping features and often neglecting (or ignoring) security concerns around things that live one layer below the application they write.

Re:Zig cc: A drop-in replacement for GCC/Clang by AnIdiotOnTheNet on Wednesday March 25, 2020 @09:17AM (#22684211)
Shared libraries have largely proven that they aren't a good idea, which is why containers are so popular. Between conflicts and broken compatibility between updates, shared libraries have become more trouble than they are worth.

I think they still make sense for base-system libraries, but unfortunately there is no agreed upon definition of 'base-system' in the wild west of Linux.

Re:Zig cc: A drop-in replacement for GCC/Clang by tannhaeuser on Tuesday March 24, 2020 @07:30PM (#22680184)
And the reason we're using containers in the first place is precisely because we've messed up and traded shared libs for having a proven-interworking set of them, something that can trivially be achieved using static linking.
Re:Zig cc: A drop-in replacement for GCC/Clang by rumanator on Tuesday March 24, 2020 @08:03PM (#22680433)
Actually the main selling point of containers has nothing to do with "proven interworking", but the ability to deploy and run entire applications in a fully controlled and fully configurable environment.

Static libraries do nothing of the sort. In fact, they make it practically impossible to pull it off.

There's far more to deploying software than mindlessly binding libraries.

Re:Zig cc: A drop-in replacement for GCC/Clang by Wowfunhappy on Wednesday March 25, 2020 @12:38PM (#22686216)
On Windows, I don't need to use Docker in order to run a program in a reproducible way. I just download a program, and in 90% of cases it "just works" whether I'm running Windows 10, Windows 8, or the decade-old Windows 7.

Furthermore, installing that program will (again, in 90% of cases at least) not affect my overall system configuration in any way. I can be confident that all of my other programs will continue to work as they have.

Why? Because any libraries which aren't included in the least-common-denominator version of Windows are included with the download, and are used only for that download. The libraries may shipped as DLLs next to the executable, which are technically dynamic, but it's the same concept—those DLL's are program-specific.

This ability is what I really miss when I try to switch to desktop Linux. I don't want to set up Docker containers for random desktop apps, and I don't want a given app to affect the state of my overall system. I want to download and run stuff.

---

I realize there's a couple of big caveats here. Since Windows programs aren't sandboxed, misbehaving programs absolutely can hose a system—but at least that's not the intended way things are supposed to work. I'm also skipping over runtimes such as Visual C++, but as I see it, those can almost be considered part of the OS at this point. And I can a ridiculous number of versions of MSVC installed simultaneously without issue.

Re:Zig cc: A drop-in replacement for GCC/Clang by rumanator on Thursday March 26, 2020 @03:37AM (#22691380)
> On Windows, I don't need to use Docker in order to run a program in a reproducible way. I just download a program, and in 90% of cases it "just works" whether I'm running Windows 10, Windows 8, or the decade-old Windows 7.

One program? How nice. How about 10 or 20 programs running at the same time, and communicating between themselves over a network? And is your program configured? Can you roll back changes not only in which versions if the programs are currently running but also how they are configured?

> This ability is what I really miss when I try to switch to desktop Linux. I don't want to set up Docker containers for random desktop apps,

You're showing some ignorance and confusion. You're somehow confusing application packages and the natural consequence of backward compatibility with containers. In Linux, deploying an application is a solved problem, unlike windows. Moreover, docker is not used to run desktop applications at all. At most, tools like Canonical's Snappy are used, which enable you to run containerized applications in a completely transparent way, from installation to running.

Re:Zig cc: A drop-in replacement for GCC/Clang by hawski on Wednesday March 25, 2020 @05:45AM (#22683167)
> the ability to deploy and run entire applications in a fully controlled and fully configurable environment

But isn't the reason to have this fully controlled and fully configurable environment to have a proof of interworking? Because when environment is in any form different you can, and people already do, say that it's not supported.

Re:Zig cc: A drop-in replacement for GCC/Clang by rumanator on Wednesday March 25, 2020 @07:44AM (#22683659)
> But isn't the reason to have this fully controlled and fully configurable environment to have a proof of interworking?

No, because there's far more to deploying apps than copying libraries somewhere.

Re:Zig cc: A drop-in replacement for GCC/Clang by yellowapple on Wednesday March 25, 2020 @11:20AM (#22685391)
> Actually the main selling point of containers has nothing to do with "proven interworking", but the ability to deploy and run entire applications in a fully controlled and fully configurable environment.

Which is exactly the same selling point as for static linking.

Re:Zig cc: A drop-in replacement for GCC/Clang by MereInterest on Tuesday March 24, 2020 @06:58PM (#22679980)
Some of us use linux as a desktop environment, and like having the security patches be applied as soon as the relevant package has updated.
Re:Zig cc: A drop-in replacement for GCC/Clang by AnIdiotOnTheNet on Wednesday March 25, 2020 @09:20AM (#22684234)
As a user of the Linux desktop, I really love it when library updates break compatibility with the software I use too. Or can't be installed because of dependency conflicts.

Containers are popular because shared libraries cause more trouble than they are worth.

Re:Zig cc: A drop-in replacement for GCC/Clang by sitkack on Tuesday March 24, 2020 @07:24PM (#22680150)
Containers most likely wouldn't have existed if we had a proper ecosystem around static linking and resolution of dependencies. Containers solve the problem of the lack of executable state control, mostly caused by dynamic linking.
Re:Zig cc: A drop-in replacement for GCC/Clang by sjwright on Tuesday March 24, 2020 @07:56PM (#22680389)
More broadly, containers solve the problem of reproducibility. No longer does software get to vomit crap all over your file system in ways that make reproducing a functioning environment frustrating and troublesome. They have the effect of side-stepping the dependencies problem, but that isn’t the core benefit.
Re:Zig cc: A drop-in replacement for GCC/Clang by senderista on Wednesday March 25, 2020 @01:12AM (#22682104)
But the images themselves are not easily reproducible with standard build tooling.
Re:Zig cc: A drop-in replacement for GCC/Clang by sjwright on Wednesday March 25, 2020 @02:55AM (#22682530)
True—but that's far less of a problem, because it rarely occurs unexpectedly and under a time crunch.

Diffing two docker images to determine the differences between builds would be far less onerous than attempting to diff a new deployment against a long-lived production server.

Re:Zig cc: A drop-in replacement for GCC/Clang by SAI_Peregrinus on Thursday March 26, 2020 @09:48AM (#22693502)
Dynamic linking isn't the issue. Shared libraries are the issue. You could bundle a bunch of .so files with your executable & stick it in a directory, and have the executable link using those. That's basically how Windows does it, and it's why there's no "dependency hell" there despite having .dlls (dynamically linked libraries) all over the place.

Shared libraries are shared (obviously) and get updated, so they're mutable. Linux systems depend on a substantial amount of shared mutable state being kept consistent. This causes lots of headaches, just as it does in concurrent programming.