Gautham Venkatasubramanian writes about building portable executables with Cosmopolitan libc, including Python and Rust examples and patching GCC.
HN links it as proof that Python and Rust can be built into single portable binaries with Cosmopolitan, answering questions about packaging without a rewrite.
> Still not a single binary but as you note with it being written in python and based on cdparanoia, etc how would that work?
Cosmopolitan python is a good starting point: https://ahgamut.github.io/2021/07/13/ape-python/
> IMO Docker is one of the "best" and most straightforward ways to package up all of this
No. Using containers has its place. But would you use containers on hello world?
Likewise, if you've got to use a container for cd ripping tool, you've failed somewhere.
> The cool thing would be multi-host static binaries
My first thought was someone is thinking about something like:
https://ahgamut.github.io/c/2021/02/27/ape-cosmo/
There is also something similar that can make binaries that run even bare metal or as EFI apps. But I can't find at the moment. (Maybe someone else has the link?)
Thanks for updating the blog post too with the datasette screen recording, the speed difference is quite noticeable.
Adding it here since a few people were wondering about it in the comments, but feel free to check the original article for the 2024 update:
https://ahgamut.github.io/images/ape-datasette.gif
The python article mentions those: https://ahgamut.github.io/2021/07/13/ape-python/
> This post describes a proof-of-concept Python executable (2.7.18 and 3.6.14) built on Cosmopolitan Libc, which allows it to run on six different operating systems (Linux, Mac, Windows, NetBSD, FreeBSD, OpenBSD)
I wonder if cosmopolitan libc[0] could be leveraged to create an actually portable executable™ without a rewrite, looks like someone has figured out compiling python 3.11.4 with it[1]
[0] https://github.com/jart/cosmopolitan
[1] https://ahgamut.github.io/2021/07/13/ape-python/
I think that should be possible with Cosmopolitan Rust (https://ahgamut.github.io/2022/07/27/ape-rust-example/). It would create a Baremetal runnable ELF binary with just cosmopolitan libc statically linked, not sure about driver support though.