June 24th, 2024

Cosmopolitan v3.5

Cosmopolitan Libc transforms C into a universal language by modifying GCC and Clang to create a POSIX-compliant polyglot format. Users can compile programs using the `cosmocc` compiler and access debugging techniques. The project provides platform notes, a Discord chatroom, and funding acknowledgments.

Read original articleLink Icon
Cosmopolitan v3.5

Cosmopolitan Libc is a tool that enables C to be a universal language without requiring an interpreter or virtual machine. It modifies GCC and Clang to produce a POSIX-compliant polyglot format that can run on various platforms. Users can access the `cosmocc` compiler and compile simple programs by following provided instructions. The project offers details on compiling Cosmopolitan from source, debugging techniques using system call logs, function call logs, and GDB, as well as platform notes for Linux, WSL, and other platforms. Additionally, there is a Discord chatroom available for communication with the development team. The project specifies minimum versions and supported platforms, and acknowledges funding sources and supporters. For further details or assistance, users are encouraged to inquire directly.

Related

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog is a compact interpreter written in C, compliant with ISO Prolog. It supports unbounded integers, UTF-8 atoms, efficient strings, and runs on Linux, Android, and WebAssembly. It offers C integration, SQLite access, concurrency features, and experimental functionalities. The project is open source under the MIT license.

Wc2: Investigates optimizing 'wc', the Unix word count program

Wc2: Investigates optimizing 'wc', the Unix word count program

The GitHub project "wc2" presents an innovative algorithm for the `wc` program, focusing on asynchronous state-machine parsing in C and JavaScript. It enhances efficiency, scalability, and speed compared to traditional `wc` implementations.

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

You can easily set up and run large language models (LLMs) on your PC using tools like Ollama, LM Suite, and Llama.cpp. Ollama supports AMD GPUs and AVX2-compatible CPUs, with straightforward installation across different systems. It offers commands for managing models and now supports select AMD Radeon cards.

A portable lightweight C FFI for Lua, based on libffi

A portable lightweight C FFI for Lua, based on libffi

A GitHub repository offers a portable lightweight C FFI for Lua, based on libffi. It aims for LuaJIT FFI compatibility, developed in C. Includes features, examples, basic types, build instructions, testing, and acknowledgements.

Why are module implementation and signatures separated in OCaml? (2018)

Why are module implementation and signatures separated in OCaml? (2018)

Separation of module implementation and signatures in OCaml enables scalable builds, creation of cmi files, and streamlined interface modifications. Emphasizing abstraction and implementation separation enhances modular programming and system reasoning.

Link Icon 26 comments
By @pixelpoet - 4 months
I checked two commits and they both had exactly the same number of chars per line, e.g. https://github.com/jart/cosmopolitan/commit/c4c812c15445f5c3...

I enjoy doing this too sometimes and don't find it too difficult, but damn...

By @geokon - 4 months
It'd be fun/great if someone made Graal Native work with it. Then things could come full circle and I could compile my Clojure/Java binaries to run everywhere (but now without a VM)
By @trustno2 - 4 months
I'm always somewhat scared - not sure if rationally or irrationally - about cosmopolitan.

It's a cool hack but I somehow feel like it should not work.

By @meisel - 4 months
Although this project is undoubtedly very cool, and maybe simplifies build processes by having a single binary, is there any other reason to use it? How does it compare in terms of performance, static linkability, standards conformance, etc. with musl and glibc? I’m curious because I’m picking a libc at the moment for my project.
By @speedgoose - 4 months
The repository also contains the source code for redbean, which is a neat web server with lua and plenty of features.

https://redbean.dev/

https://github.com/jart/cosmopolitan/tree/master/tool/net

By @kortex - 4 months
Looking forward toward somebody hooking together Python in APE [0], something like pex [1]/shiv[2]/pyinstaller[3], and the pants build system [4] to have a toolchain which spits out single-file python executables with baked-in venv and portable across mainstream OSes with native (or close enough) performance.

0 - https://news.ycombinator.com/item?id=40040342

1 - https://docs.pex-tool.org/

2 - https://shiv.readthedocs.io/en/latest/

3 - https://pyinstaller.org/en/stable/

4 - https://www.pantsbuild.org/

By @Nevin1901 - 4 months
The "actually portable executable header", fun to read through: https://raw.githubusercontent.com/jart/cosmopolitan/1.0/ape/...
By @aidenn0 - 4 months
I've been following it for almost 4 years now and I still do not know how serious of a project Cosmopolitain/αpε is.
By @m1keil - 4 months
Cosmo looks so cool. Are there any big projects out there that use it for distribution?
By @auggierose - 4 months
Is there a UI library that goes with that?
By @mkl - 4 months
By @superkuh - 4 months
Any idea if there will ever be a fix for the majority of linux distributions that cannot run cosmopolitan C applications without the bin fmt fix?
By @stephc_int13 - 4 months
Is there a plan to distribute the cosmopolitan libc without all the APE stuff?

For now it seems to be more like a framework+toolchain than a standalone library.

By @throwaway2037 - 4 months
From here: https://github.com/jart/cosmopolitan/releases/tag/3.5.0

Justine wrote:

    > We've made a lot of progress reinventing the C++ STL.
What is the motivation behind this? Try to reduce (compiled) binary size? Naively, I am surprised that the C++ STL from Clang isn't OK to use, including the license. Or is this a clean room impl thing?

EDIT

To be clear: I mean no disrespect with this question. This is an amazing project.

EDIT 2

Ok, I just spotted this commit message:

https://github.com/jart/cosmopolitan/commit/c4c812c15445f5c3...

    > We now have a C++ red-black tree implementation that implements standard
template library compatible APIs while compiling 10x faster than libcxx.

Can someone explain to an average C++ programmer like me how they make it compile 10x faster !?

By @tarruda - 4 months
I wonder if it is possible to have a 100% portable qemu build with this. Would be funny to have a usb stick with qemu + VM that runs on any OS.
By @modeless - 4 months
The commit message for the first commit there says "Actually Portable Executable now supports Android". I assume this means that the bare executables can run on Android kernels, not that there's any support for installing APEs as Android apps. But it seems possible for that to eventually work! Is that a goal of the project?
By @sangnoir - 4 months
I gave up trying to run cgo-compiled Go on an old appliance[1] the version of libc was simply too old. Has anyone ever successfully built cosmopolitan-flavored cgo binaries? I see Cosmopolitan libc supports Linux 2.6, so I'm hopeful.

1. Linux 2.x on little-endian MIPS.

By @j16sdiz - 4 months
in release note:

> ... , it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format ...

Did POSIX really _approve_ this? if yes, when?

By @zbendefy - 4 months
wouldn't targeting webassembly provide something similiar? how would this compare to targeting WASM and running a runtime like wasmer?
By @nuc1e0n - 4 months
Can anyone point me to examples of this being used as a dependancy of other projects?
By @bdahz - 4 months
How does cosmopolitan support GPU-based applications?
By @tiffanyh - 4 months
I assumed OpenBSD introducing pinning syscalls would prevent Cosmo from working.

I guess not.

https://news.ycombinator.com/item?id=38579913

By @fusslo - 4 months
Never heard of Cosmopolitan before, but can I just say I really appreciate that the FIRST paragraph is a description of WHAT Cosmopolitan is and does.

There's way too many readme's that just jump in and assume the reader already is familiar with the project. it's a pet peeve of mine

By @WantonQuantum - 4 months
I assume the executables won't run on ARM platforms? So modern Macs are out, etc.