// the find
jart/cosmopolitan
build-once run-anywhere c library
Cosmopolitan is a C/C++ libc that produces binaries running natively on Linux, macOS, Windows, FreeBSD, OpenBSD, and NetBSD from a single compile. It works by encoding the executable as a polyglot file that each OS's loader can interpret without a JVM or interpreter layer. It's for developers who distribute C/C++ CLI tools and are tired of maintaining per-platform build pipelines.
The APE (Actually Portable Executable) format is genuinely clever — a single file that satisfies both ELF and PE/COFF loaders by exploiting format ambiguity at the file header level. Built-in `--strace` and `--ftrace` flags that work cross-platform are a real debugging win that native platform tools can't match. The included CTL directory ships a reimplemented C++ STL designed specifically for this toolchain, which avoids the usual libc++ compatibility headaches. Binary sizes can get absurdly small (12KB in `tinylinux` mode) because the libc is compiled in, not dynamically linked.
WSL support requires disabling WSLInterop system-wide, which affects every other Windows/Linux interop tool on the machine — that's an invasive ask. macOS support only starts at 23.1.0 (Sonoma), which cuts out a meaningful chunk of enterprise Mac users still on Ventura. The build system is a massive GNU Make monorepo with bootstrap binaries checked into git — onboarding is slower than it looks, and the 'just run make' promise breaks in non-obvious ways on some distros. Dynamic linking is not supported; everything must be statically linked, which is a dealbreaker for plugins or anything that needs to load third-party shared libraries at runtime.