cosmopolitan

fast portable static native textmode executable containers (by jart)
C

Cosmopolitan Alternatives

Similar projects and alternatives to cosmopolitan
  • freebsd

    FreeBSD src tree (read-only mirror)

  • zig-window

    window client library

  • glad

    Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.

  • web-ui-skeleton

    Skeleton for a cross-platform native app with a web-based UI.

NOTE: The number of mentions on this list indicates mentions on common posts. Hence, a higher number means a better alternative or higher similarity.

Posts

Posts where cosmopolitan has been mentioned. We have used some of these posts to build our list of alternatives and similar projects - the last one was on 2020-12-27.
  • cosmopolitan libcs claim: build once, run everywhere
    reddit.com/r/Zig | 2020-12-28
    246k LOC C and 46k assembler is quite an effort the person took. Source.
  • Cosmopolitan Libc: build-once run-anywhere C library
    news.ycombinator.com | 2020-12-27
    Author here. tcc is tired and chibicc is wired. Check out https://github.com/jart/cosmopolitan/blob/master/third_party... where I've been working on building a 300kb actually portable executable c11 compiler + assembler + linker that supports all the best gnu extensions.
    news.ycombinator.com | 2020-12-27
    Author here. That's not an inherent limitation. See https://justine.lol/apelife/index.html for an example of a GUI + TUI that's built using Cosmopolitan. The reason why I said what you quoted, is I'm simply trying to calibrate expectations. I don't view desktop GUIs as a productive area of focus, because there's such a lack of consensus surrounding the APIs that requires, and web browsers do a great job.

    As for sizeof(long) it's 64-bit with Cosmopolitan, which uses an LP64 data model. That hasn't impacted its ability to use the WIN32 API at all. See https://github.com/jart/cosmopolitan/tree/master/libc/nt where WIN32 API functions are declared using uint32_t, int64_t, etc. It works great. Cosmopolitan even takes care of the chore of translating your UTF-8 strings into UTF-16 when polyfilling functions like open() which delegates to CreateFile() on Windows.

    news.ycombinator.com | 2020-12-27
    Author here. The example and repository has been updated. Many eyes make all bugs shallow. I was hoping to do more testing before posting on Hacker News. Now that the cat's out of the bag, I'd like to explain what's being done to make sure bugs like that never happen.

    Cosmopolitan implements a simplified version of the Address Sanitizer (ASAN) runtime. See https://github.com/jart/cosmopolitan/blob/master/libc/log/as... I've been systematically working towards using it to vet the entire codebase. It's helped to address many memory issues so far. However more work needs to be done polishing the ASAN code so it can be bootstrapped for the purposes of having memory safety in the lowest level libraries like LIBC_STR.

    This has been less of an issue, because bugs are normally very evident in functions like strcpy(). The BSD version is an exception though, since it was only used to port programs from the OpenBSD codebase which were used sparingly. But in either case, the real focus here is having continual incremental improvements over time, and I'm very committed to addressing any and all concerns.

    news.ycombinator.com | 2020-12-27
    Basically unsetting the Windows bit causes the Windows polyfills to not be linked in your binary. It's only useful for making binaries tinier. So rest assured, if you find your 16kb APE .com binary to be too bloated, you can always use SUPPORT_VECTOR to squeeze it down to the order of a 4kb ELF executable. See: https://github.com/jart/cosmopolitan/blob/1df136323be2ae806f...
    news.ycombinator.com | 2020-12-27
    If anyone's curious, here's the link to memcpy() as it's actually implemented in the Cosmopolitan headers: https://github.com/jart/cosmopolitan/blob/de09bec215675e9b0b... One thing that the web page doesn't mention (for the sake of simplicity) is that the Cosmopolitan headers do call __builtin_memcpy() as well, but only for 2-power constexpr sizes. That's the only time when GCC and Clang both do the optimal thing. In all other cases it's faster to use asm("call MemCpy") which implements something faster than the builtin would otherwise generate. See https://github.com/jart/cosmopolitan/blob/de09bec215675e9b0b...
    news.ycombinator.com | 2020-12-27
    Really? I thought x86 was pretty straightforward once I grokked the octal encoding. Cosmopolitan provides a 3kb x86 instruction length decoder that supports all past, present, and future ISAs: https://github.com/jart/cosmopolitan/blob/master/third_party... The Cosmopolitan also provides a debugger / emulator for i8086 + x86-64 that's similar to GDB TUI and Bochs. See https://justine.lol/blinkenlights/index.html
  • cosmopolitan libc
    Figuring out those magic numbers was a toilsome act of public service that I'm happy to say I performed, in service to you all.
    See https://justine.lol/cosmopolitan/documentation.html I just spent the last few days modifying chibicc to generate that page.

Stats

Basic cosmopolitan repo stats
16
1,082
7.5
7 days ago