Justine Tunney - Redbean and the Actually Portable Executable (Speakeasy JS, May 2021) - Despite the channel, this is about a C executable that "runs anywhere", including from boot
Video is nearly 3 years old now, but I think it's worth watching. Her presentation starts at around 2:30.
Basically, she explains how Redbean, a tiny (~450kb) and very fast C http server, works and how the same executable can be used to deploy it on most operating systems (she starts explaining that around 14:30)
I remember seeing something like this a while ago. Maybe she rediscovered the hack to make multiplatform executables on her own or she was inspired. nexe has existed for 11 years now.
That nexe looks nothing like cosmopolitan. Nexe compiles a node.js into a single exe for Windows and, from the readme, can create native binaries for other distributions (Linux, Mac), something that isn't new to Nexe, you could do that with FreePascal way before Nexe. If you avoided OS specific calls, you could pull that since the early 90s with C, too.
Compiling the same codebase for N different platforms, generating N different native binaries, isn't the same as having one single executable file that runs out of the box on significantly different OSs. Put it another way, she made a java that works without needing a JRE or JDK installed.
🤔 I swear I've seen this multiplatform single executable before. Maybe nexe isn't it, but as soon as she whipped out the hexcode and talking about binary headers, it felt more than a dejavu.
Someone did it years ago, put it in github, and it was called an abomination.
It's very similar in vein to this script that can be executed by bash and powershell.