Releases: jart/cosmopolitan
Cosmopolitan v3.2
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 Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README.
Our latest 3.2 release features exciting fixes and improvements.
- 83107f7 Introduce FreeBSD ARM64 support
- 43fe595 Use DNS implementation from Musl Libc
- 7961487 Remove hard coded paths from APE bootloader (NixOS)
- f8ea02d Import /etc/shadow support from Musl for Linux
- ce0143e Fix madvise() on Windows
- 873069f Fix -Xaarch64 in cosmocc
- 1a28e35 Use good locks in dlmalloc
- cd52c59 Allow MAP_POPULATE under pledge()
- e36283f Support double parameters in dlsym() imports
- 6be9477 Fix redbean to only check additional content types when Lua is present (#1033)
We've fixed important threading bugs on /zip/...
file descriptors.
- 53357aa Fix __zipos_close (#984)
- 8a10ccf Fix ZipOS deadlock/segfault (#1011)
- 5c35863 Rename __zipos_free -> __zipos_drop (#1043)
- 4c6f928 Disable argv[0] tests on non-XnuSilicon (#1015)
We now have a hack that lets you use cosmo binaries as a login shell.
Setuid security is improved. Executable path self-detection is better.
There's a new APE loader version as a result. If you have a systemwide
APE loader install, it's recommended that you upgrade, but not required.
- 81949f0 Mint APE Loader v1.10
- 2a3813c $prog.ape support (#977)
- f94c11d Loader path security (#1012)
- 68dbe53 Prepend getcwd to exename early in init (#1048)
- b02d13c Re-enable/fix non-argv[0] exe name tests (#1046)
- 10b4693 Sanity-check set-id interpreter script paths (#1029)
- 77facc4 Cover more cases for detecting ape loader (#1022)
- 2a11a09 Remove realpath/getcwd from loaders (#1024)
- d8ad346 Implement issetugid() on NetBSD
Our public header files now have better open source compatibility.
Cosmopolitan v3.1.3
- 69ba516 Revert "Re-enable apelink size optimization"
Cosmopolitan v3.1.2
- d1a745c Implement __zipos_dup (#972)
- 4b7ba9a Fix some bugs with dup2() and ZipOS
- 7845495 Get tool/cosmocc/package.sh working on M1 (#970)
- 14bf571 Make cosmocc
make
work right on aarch64 - 7b3d7ee Re-enable apelink size optimization
- ff955aa Make memcmp() and memchr() go fast again
- 70155df Avoid linking win32 signals impl
- 2b960bb Exclude strace from MODE=tiny builds
Cosmopolitan v3.1.1
- 41c06c6 Make cosmocc 100x faster on MacOS
- 43de12d Introduce forkpty()
- cc5c531 Linux: Add cachestat, fchmodat2 syscalls (#958)
- 0bffd09 Allow redbean to accept --assimilate option without complaining (#916)
- 96185e1 Fix MODE=aarch64 cross-compiling
- ca5e361 Don't show
(win32 error 0)
- 9cad66a Freshen bootstrap binaries for MacOS + SIP
- 96f979d Rename makefiles BUILD.mk
Cosmopolitan v3.1
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 Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable.
Overview
This release fixes issues with the 3.0.x series. A new cosmo_dlopen()
function is now provided that's good enough to load nontrivial dynamic libraries on all platforms except OpenBSD. Cosmos binaries are now being distributed on our new online service https://cosmo.zip/ that's operated by the Cosmopolitan authors. This release was made possible thanks to the testing and contribution efforts of our GitHub and Discord communities https://discord.gg/FwAVVu7eJ4. Thank you!
Changes
- 5330442 Avoid APE fork bomb
- 291103a Redesign
cosmocc
toolchain - 751d20d Fix nsync_mu_unlock_slow_() on Apple Silicon
- 3ac473d Floating point parsing support for scanf family (#924)
- 8caf1b4 Improve time/sleep accuracy on Windows
- e4dea37 Make clock_nanosleep() cancel faster
- 32b97f2 Improve execve() path argument munging
- bcf268a Don't modify argument block on MacOS Arm64
- 0863427 Make development more pleasant on MacOS Arm64
- 48bd3d8 Fix sigaction() return handler address on XNU/BSD
- 3e6d536 Correct misunderstanding with zip64 extra records
- 0c89516 Fix unzip warning with apelink generated symtabs
- f25beb3 Add architecture flag to zipobj
- 736fdb7 Implement raise() with getcontext() / setcontext
- bd56a9c Rename dlopen() to cosmo_dlopen()
- f7cfe03 Fix dlopen() for FreeBSD and NetBSD
- 529cb48 Improve dlopen() on Apple Silicon
- dffee60 Run host compiler to create dlopen helper
- e4584ac Get cosmo_dlopen() working better on System Five
- ac125d3 Fix console copy/paste issue on Windows
- e961385 Put more thought into Windows i/o polyfills
- 7138399 Close Lua state before exiting redbean worker to allow GC to collect (#941)
- 5c1fdc9 Fix session changeset procesing (reverting some of 0d748ad changes) (#949)
- ddc08dc [metal] Make deathstar.com draw onto both VGA and serial consoles (#955)
- eea601f [metal] Some minor fixes and tweaks (#933)
- 545a8f4 Add more sched.h content
- 7a9e176 Improve debug binary location detection
- 68c7c9c Make strerror() conform more to other libc impls and introduce __clear_cache()
- 8f5e516 Remove sync_file_range
- 1351d3c Remove bool from public headers
- 1c2e7c1 Introduce SIP_DISABLED compile option for ape-m1.c
- 3b15d31 Fix
#include <shared_mutex>
- c6d3802 Add more fixes for new cosmocc toolchain
- cdbd10c Introduce X86_CHECK() macro
- d2f49ca Improve mkdeps
- 15af5c2 Fix ucontext_t alignment in strict ansi mode
- b8d1377 Give new wait4() another review pass
- ea28f93 Support includes in monorepo
- cc3e3de Make
args
replace...
only at the end of file (#909)
Known Issues
Shells
If you use zsh and have trouble running APE programs try sh -c ./prog
or simply upgrade to zsh 5.9+ (since we patched it two years ago). The same is the case for Python subprocess
, old versions of fish, etc.
Linux
Some Linux systems are configured to launch MZ executables under WINE or run-detectors
. You can fix that by registering APE with binfmt_misc
:
sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
If things still aren't working, it's also possible to disable binfmt_misc
as follows:
sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/cli' # remove Ubuntu's MZ interpreter
sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/status' # remove ALL binfmt_misc entries
WSL
WSL tries to run MZ executables as WIN32 binaries within the WSL environment. In order to make it safe to use Cosmopolitan software on WSL, run this:
sudo sh -c "echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop"
Cosmopolitan v3.0.2
Features
- Introduce
getifaddrs()
024be3b - Introduce very primitive
dlopen()
support 5e8c928 - Make it possible to use APE Loader on Apple Silicon systems with SIP enabled a12ad17
Bug Fixes
- Fix APE Loader CRT bugs which caused crashes for MacOS x86-64 users (#931)
- Fix
getcwd()
on Windows which was causing weirdness withbash
1eb6484 - Embed GNU TLS in Cosmos Emacs so
M-x package-list-packages
will work on Windows - Use
/usr/local/bin/ape
(instead of/usr/bin/ape
) on Apple Silicon for systemwide APE. - Add database and statement readonly checks to sqlite in redbean (#914)
- Make WIN32 i/o signals more atomic and
longjmp()
safe d7917ea - Support
\n
in/zip/.args
files 585c86e - Make
cosmocc -dumpmachine
work
Upgrade Notes
If you've used ape-install
or ape/ape-install.sh
in the past (to install the system-wide APE Loader) then you need to run it again so that your system can use APE Loader v1.9. This new release of APE Loader fixes bugs. Apple M1 systems need it to run the APE binaries in this release..It's also backwards compatible with all APE and static ELF binaries ever made with Cosmo. Any of your own programs which you've compiled before on Apple Silicon which use execve()
may need to be recompiled in order to run the latest APE executables unless you've installed a system-wide APE Loader.
It's recommended that cosmocc
users run:
cd /opt/cosmo
rm -rf o/third_party/gcc
unzip -vl cosmocc-0.0.18.zip
To get the latest build of Cosmopolitan's toolchain.
Cosmopolitan v3.0.1
Release notes: https://justine.lol/cosmo3/
Cosmopolitan v3.0
Release notes upcoming.
Cosmopolitan v2.2
Cosmopolitan Libc makes C/C++ a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS or UEFI with the best possible performance and the tiniest footprint imaginable.
Getting Started
If you use Linux, then you can build Cosmopolitan and its included software from source as follows:
wget https://justine.lol/cosmopolitan/cosmopolitan-2.2.tar.gz
tar xf cosmopolitan-2.2.tar.gz
cd cosmopolitan
build/bootstrap/make.com -j8
o//examples/hello.com
If you're doing your development work on Linux or BSD and you want to bring your own build system, then you need just five files to get started:
wget https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.2.zip
unzip cosmopolitan-amalgamation-2.2.zip
printf 'main() { printf("hello world\\n"); }\n' >hello.c
gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone -gdwarf-4 \
-fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs \
-o hello.com.dbg hello.c -fuse-ld=bfd -Wl,-T,ape.lds -Wl,--gc-sections \
-include cosmopolitan.h crt.o ape-no-modify-self.o cosmopolitan.a
objcopy -S -O binary hello.com.dbg hello.com
Features
- Implement POSIX semaphores 8111462
- Implement POSIX cancellations 2278327 022536c 3f0bcdc 3f0bcdc 4a6fd3d e522aa3
- Implement atomic swar token bucket library for DDOS protection e7329b7
- Introduce sigtimedwait() and sigwaitinfo() 467a332
- Invent iso8601us() for faster timestamps f7ff77d
- Work towards zipos / open(argv[0]) on metal cb9a046
- Introduce readdir_r, scandir, pthread_kill, sigsetjmp, etc.. e557058
- Allow more fine-grained control over bare metal page permissions d387006
- Make cli commands yoinkable into cosmo shell 3d2d04b
- Support Ctrl-Left / Ctrl-Right keystrokes in Bestline
- Introduce a ParseCidr() API c995838
Fixes and Improvements
- Make fcntl() locks on Windows work well enough to support SQLite 997ce29
- Make fork/system/popen thread safe 60cb435 f52f65b
- Fix support for WSL1 platform fc96af0 f44d887 d6ff4c7 fae0c02 14d036b
- Fix bug: do not initialize IDT & TSS if unneeded (#654)
- Integrate upstream dash changes into unbourne shell (#656)
- Import more of the remaining math library routines from Musl e557058
- Make the conformance of libc/isystem/ headers nearly perfect e557058
- Fixed bug where stdio eof wasn't being sticky d5910e2
- Fixed bug where fseeko() wasn't clearing eof state d5910e2
- Fix ParseHttpMessage failing to store >2 repeatable headers (#657)
- Fix a harmless integer overflow in ParseIp() c995838
- Improve cosmo's conformance to libc-test e557058
- Improve lock performance on NetBSD c995838
- Elevate the quality of getrandom() and getentropy() 3f0bcdc
- Make Windows fcntl() and lseek() fixes da8f500
- Windows fork() now restores TLS memory of calling thread e522aa3
- More cosmocc toolchain FOSS compatibility improvements 5af19b7
- Rewrite makedirs() so it doesn't need dynamic memory 0f89140
- Rewrite putenv() and friends to conform to POSIX f7ff77d
- Permit Linux OFD fcntl() locks under pledge(flock) f7ff77d
- Support closefrom() on NetBSD
- Support tgkill() on FreeBSD
Breakages
Cosmopolitan v2.1.1
Cosmopolitan Libc makes C/C++ a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS or UEFI with the best possible performance and the tiniest footprint imaginable.
This release fixes bugs and makes system call wrapper improvements:
- Fix corner case in Linux stack mappings 3b4fcd8
- Implement clock_nanosleep() across platforms and refactor sleeping code to use it.
- Polyfill futexes on unsupported platforms by polling memory with exponential backoff
- Imported *NSYNC unit tests and confirmed we're passing them (except for cancellations on Windows)
- system() now uses our builtin cocmd interpreter which offers a subset of bourne that works on windows and is fast
- sched_setaffinty() is now explicitly for processes since we now have pthread_setaffinity_np() for threads
- Numerous improvements to system call documentation, especially when it comes to possible errno results
- Change accept type to
struct sockaddr *
(#630) - Rewrite brk() and sbrk() 5005f2e which can be used by tiny apps that don't want to link mmap() and would rather have 4096-byte memory granularity, with the tradeoff of not working on Windows
We're working to make every Cosmopolitan binary a true operating system by introducing features like VGA support:
- Fix sys_mmap_metal() for non-MAP_FIXED case (#651)
- Show "screen of death" on VGA console upon program crash (#650)
- Add basic character output for VGA graphics mode console (#649
Other changes: