This release added cosmo_dlopen, which works on many platforms (but not all).
Should be enough to allow you to find the vulkan loader and dlopen that. I'm not sure what you would do on mac, statically link moltenvk? Or maybe it would be better to use OpenGL on all platforms, and be stuck with OpenGL 4.1 (which isn't too bad, but it would be nice to have image load/store).
Even though GitHub Actions did wonders for people to be able to build their software in multiple platforms, you still have to run one build per platform and distribute one file per platform. If you could run a single build instead (and be confident that Cosmo guarantees that if it works on one, it works on the others, which may be difficult of course) and distribute a single file, that would make things much simpler and more efficient. You could save a lot of electricity if you run builds on premise (not to mention it's good for the environment). I can't believe people don't see a value in this.
Most binaries that I have seen in the wild use cosmo/ape binary format to have "free obfuscation" that is hard to analyze by antivirus and EDR software due to its mutating self-extracting pkzip-like behavior.
Well, and of course CLI tools. I guess it's the same selling points that fit golang as well - aside from cosmo's binary format having a universal header.
Isn't it just a matter of updating the AV to be aware of this format? It's not like APE is the only "weird" binary format that exists, since there's stuff like UPX (which is indeed flagged by many AVs).
I absolutely would use this for workshops I give, where users bring a variety of oddball hardware and want to do things like run FPGA synthesis or run software that pokes USB packets to communicate with debug endpoints.
In the past I've made sure to build for each platform in CI and distribute USB drives, and this just makes it one notch easier by letting me ship the same binaries to everyone.
Honestly - CLI apps that need to run on multiple platforms. I once built a version of https://github.com/lovebrew/lovebrew (back when it was written in Nim) using Cosmopolitan 2, and I got back a single binary that ran on all major operating systems.
This greatly reduces the time GitHub actions would need to run, as you just build and release for one OS. As others have mentioned, this does not really work for native GUI apps, that isn't supported by Cosmopolitan as far as I know. But for small CLI tools it works great!
I imagine portable apps might be nice. It would be cool to be able to create a flash drive with universal PGP toolkit. We're limited to console apps, though.
It would be amusing to use it to create X servers – after all, we have sockets.
I've been dying to play with cosmopolitan for a while while working on a micro-Lisp and another interpreted language that I've been designing for a while.
Imagine writing an interpreter that's compiled with cosmopolitan, you bundle it with your program source code, and bam! your script runs pretty much everywhere, even on bare metal. How cool is that? I could distribute my apps written in my niche Lisp to anyone, without having to write a JIT, or incorporate LLVM, or asking them to download and compile my interpreter from github. Here's a binary, just run it (if you trust me :)
To me it's mind blowing, and I have enormous respect for the work of Justine and her collaborators.
> a micro-Lisp and another interpreted language that I've been designing for a while
> bundle it with your program source code, and bam! your script runs pretty much everywhere
> How cool is that?
Extremely cool! I've got a small lisp too and cosmopolitan inspired me to work on similar stuff. Seems I'm not alone.
While cosmopolitan's PKZIP support is impressive, I've been perfecting an alternative method to embedding source code inside the lisp interpreter executable that's more tightly integrated. Cosmopolitan libc opens the executable and reads the data from the filesystem. I want the data to already be mapped in before execution even starts.
I only target Linux so I get to take full advantage of the ELF format: concatenate the data to the ELF and add a PT_LOAD segment for it so that Linux loads it onto memory automatically. So far my work has resulted in a new feature being added to the mold linker and and a couple stackoverflow questions. Just submitted a pull request to the patchelf utility too.
Once it's working, I'll write an article about it and submit it here.
> concatenate the data to the ELF and add a PT_LOAD segment for it so that Linux loads it onto memory automatically
I was reading Justine's Github profile, and there was a mention of POSIX systems natively supporting shebang programs made of binary + appended data out of the box. I don't remember the specifics, might be worth investigating how that works exactly.
Yeah, she actually got that feature standardized. Apparently it's a binary version of the feature used in those self-extracting installer .run scripts.
I finished the embedded segment loading feature by the way. I'm writing that article as promised but if you'd like to check it out ahead of time:
One thing I’ve found useful is that you can attach a zip, and the files in it that zip can be opened with open() as normal. This makes it easy to wrap multi-file Python apps (or other languages) as a single executable.
Neat, they also launched a repo for these universal binaries [0]. It took a little digging, but the list of binaries are here [1]. Might be useful for a universal install script?
The Linux system calls used by cosmopolitan work fine on Android provided they aren't blocked by seccomp policy. Some of those blocks make sense, others not so much. Yesterday I discovered I could use all the stat variants but not statx.
I believe the features provided by standard C libraries are well covered by the set of allowed system calls.
A few weeks ago I tried building cosmopolitan inside a Termux environment but the makefile didn't like it. At the time I gave up and used my laptop because I was focused on developing a feature. I wonder if I could get it to work now.
Does this work for platform/architecture independent docker images? I tried a little with the python universal binary, but I think the CMD line would be platform specific?
I have mad respect for cosmo & what technically it’s accomplished.
But I also haven’t figured out the problem per se it’s solving.
I’m genuinely curious to hear how others use cosmo.