cosmocc is a precompiled version of GCC that produces polyglot
executables for the x86_64 / aarch64 architecture using the
Cosmopolitan libc.
Cosmopolitan Libc makes C a build-once run-anywhere language, like Java,
except it doesn't need an interpreter or virtual machine. Instead, it
reconfigures stock GCC and Clang to output a POSIX-approved polyglot
format that runs natively on many operating systems with the best
possible performance and a tiny footprint.
======= Support Vector =======
Platform | Min Version | Circa
==============================
AMD | K8 Venus | 2005
Intel | Core | 2006
Linux | 2.6.18 | 2007
Windows | 8 | 2012
Mac OS X | 15.6 | 2018
OpenBSD | 7 | 2021
FreeBSD | 13 | 2020
NetBSD | 9.2 | 2021
==============================
NOTES:
* on calling APE programs:
upto zsh version 5.9, it's required to call APE programs
this way:
sh -c ./APE-program
The same case is for Python's subprocess, old versions of fish, etc.
* on reproducible builds:
The cosmocc compiler is designed to generate deterministic output
across platforms. Please note that users who need reproducible
builds may also want to look into explicitly defining environment
variables like `LC_ALL=C` and `SOURCE_DATE_EPOCH=0`, in addition to
undefining macros such as `-U__DATE__` and `-U__TIME__`.
* on (un)registering APE with binfmt_misc:
two simple scripts are included in case you want to register or
unregister the APE loader with the binfmt_misc kernel facility.
You may find them in the /opt/cosmocc/scripts/ directory.