They also made cosmopolitan libc [0] which outputs a single binary that runs on many platforms.<p>> The above command fixes GCC so it outputs portable binaries that will run on every Linux distro in addition to Mac OS X, Windows NT, FreeBSD, OpenBSD, and NetBSD too. Your program will also boot on bare metal too. In other words, you've written a normal textbook C program, and thanks to Cosmopolitan's low-level linker magic, you've effectively created your own operating system which happens to run on all the existing ones as well.<p>Brought up recently here: "Debugging C with Cosmopolitan Libc" [1]<p>And introduced here "Cosmopolitan Libc: build-once run-anywhere C library" [2]<p>[0] <a href="https://justine.lol/cosmopolitan/index.html" rel="nofollow">https://justine.lol/cosmopolitan/index.html</a><p>[1] <a href="https://news.ycombinator.com/item?id=33312012" rel="nofollow">https://news.ycombinator.com/item?id=33312012</a><p>[2] <a href="https://news.ycombinator.com/item?id=25556286" rel="nofollow">https://news.ycombinator.com/item?id=25556286</a>
> It'll be nice to know that any normal PC program we write will "just work" on Raspberry Pi and Apple ARM. All we have to do embed an ARM build of the emulator above within our x86 executables, and have them morph and re-exec appropriately, similar to how Cosmopolitan is already doing doing with qemu-x86_64, except that this wouldn't need to be installed beforehand. The tradeoff is that, if we do this, binaries will only be 10x smaller than Go's Hello World, instead of 100x smaller.<p>…No mention of the fact that an interpreter is typically at least 10x slower than native execution. The readme does say "we're still likely to add something like jit in the near future", but for now this isn't very practical.
This project is interesting, but I looked at tests folder and there is not many tests despite software is so complex. Also I wonder, isn't it better to write tests in languages like Python?<p>Also, I don't see what's the use of Cosmopolitan Libc. In what situation does one need a CLI-only binary that can run on any system?