Cosmopolitan v3.1
twitter.com
twitter.com
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.
Although personally, the lack of dynamic linking or GPU acceleration makes it a hard sell for my projects, unfortunately.
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).
It’s like LLVM or JVM but even for C, and without the overhead of virtualization.
(Hope I did it justice I am merely a fan)
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).
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.
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!
It would be amusing to use it to create X servers – after all, we have sockets.
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.
> 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.
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.
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:
https://github.com/lone-lang/lone/blob/master/source/tools/l...
https://github.com/lone-lang/lone/blob/master/source/lone/au...
https://github.com/lone-lang/lone/blob/master/source/lone/se...
https://github.com/lone-lang/lone/blob/master/source/lone/mo...
I believe the features provided by standard C libraries are well covered by the set of allowed system calls.
I found the performance gain to be significant enough to be interesting and so I posted.
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...