Hacker GitHub

← All repos

jart/cosmopolitan

View on GitHub ↗ ★ 21,431 C

build-once run-anywhere c library

293 mentions on Hacker News by 135 people: 24 stories, 269 comments · first 2020-06-20 · latest 2026-10-11

Mentions per year 293 mentions · busiest year 2021 (69)
20082026
  1. Real link: https://github.com/jart/cosmopolitan/releases/tag/3.1
    comment by bmacho · 2023-11-20 · in Cosmopolitan v3.1
  2. ▲ 9
    Release Cosmopolitan v3.1
    story by ofou · 2023-11-19 · 3 comments
  3. …the same binary will run on windows, linux, mac, and BIOS. /s This has been done with Lua, see: https://github.com/jart/cosmopolitan/issues/61
    comment by jakobson14 · 2023-11-06 · in A standalone zero-dependency Lisp for Linux
  4. Good news: https://github.com/jart/cosmopolitan/commit/5e8c928f1a37349a...
    comment by dylukes · 2023-11-04 · in Cosmopolitan Third Edition
  5. Pull request sent. https://github.com/jart/cosmopolitan/pull/924 Oops, I only now realized there's a test suite. I'll be adding tests too... After I get some sleep.
    comment by matheusmoreira · 2023-11-02 · in Cosmopolitan Third Edition
  6. See the comments in https://justine.lol/ape.patch and at the bottom of https://github.com/jart/cosmopolitan/blob/3.0/tool/build/ape... and also https://github.com/jart/cosmopolitan/blob/3.0/ape/loader.c has good information too. I'm…
    comment by jart · 2023-11-02 · in Cosmopolitan Third Edition
  7. Cool. Somebody still needs to teach sscanf how to parse floats though. https://github.com/jart/cosmopolitan/issues/456 The code to do it would probably go in here: https://github.com/jart/cosmopolitan/blob/master/libc/stdio/... I mean, I…
    comment by smcameron · 2023-11-02 · in Cosmopolitan Third Edition
  8. Author here. We've got you covered. Search for `MODE=tinylinux` in the https://github.com/jart/cosmopolitan#getting-started section of the README. If you use that build mode, then hello world for x86 linux is only 8kb in size. It's very…
    comment by jart · 2023-11-01 · in Cosmopolitan Third Edition
  9. Discuss here: https://github.com/jart/cosmopolitan/discussions Add issues here: https://github.com/jart/cosmopolitan/issues
    comment by AMICABoard · 2023-11-01 · in Cosmopolitan Third Edition
  10. Yes they do! https://github.com/jart/cosmopolitan/tree/master/third_party... and https://github.com/trholding/llama2.c
    comment by AMICABoard · 2023-11-01 · in Cosmopolitan Third Edition
  11. There's so much cool stuff in this post. https://github.com/jart/cosmopolitan/releases/download/3.0.1... is 213MB file which contains "fat binaries" (single binaries that execute on a bewildering array of hardware platforms and operating…
    comment by simonw · 2023-11-01 · in Cosmopolitan Third Edition
  12. …can even go above and beyond with cosmopolitan libc v2, which makes c/c++ build-once run-anywhere: https://github.com/jart/cosmopolitan/releases/tag/2.0 There seems to be some work getting cosmopolitan libc support in Go, but it is not…
    comment by mathiasgredal · 2023-09-17 · in Java 21 makes me like Java again
  13. …means you can write a simpler algorithm than what Lemire did that assumes an ASCII average case. https://github.com/jart/cosmopolitan/blob/755ae64e73ef5ef7d1... That goes 23 GB/s on my machine using just SSE2 (rather than AVX512). However…
  14. …old fashioned way. The recent version of cosmopolitan generates ARM binaries for Linux and MacOS ( https://github.com/jart/cosmopolitan#arm; mode aarch64). There is also blink that provides the x86-64 emulation layer for (APE and other)…
  15. …convert to/from the old constants during runtime is too much. Look at the list of constants here: https://github.com/jart/cosmopolitan/blob/master/libc/sysv/c... Every time I used any of these constants, I'd have to load a whole bunch of…
  16. There seems to be a standard socket API in the Cosmopolitan clib though: https://github.com/jart/cosmopolitan/tree/master/libc/sock ..and that also seems to have WinSock support: https://github.com/jart/cosmopolitan/blob/master/libc/sock/c.…
  17. …to inject a SECCOMP filter. Then you can block execve(). See https://justine.lol/pledge/ and https://github.com/jart/cosmopolitan/blob/master/tool/build/...
  18. …you pass a pipe into the whole (server) process, instead of having it open its own sockets? (In https://github.com/jart/cosmopolitan/blob/48b2afb192ec18eca4... , I gather?) I haven't followed cosmopolitan / Linux pledge() too closely; but…
    comment by JoachimSchipper · 2023-06-19 · in Redbean Systems
  19. See https://github.com/jart/cosmopolitan/commit/48b2afb192ec18ec... and https://twitter.com/JustineTunney/status/1670600564164657154
    comment by jart · 2023-06-19 · in Redbean Systems
  20. …datagrams so it can blackhole your IP address in the RAW PREROUTING iptable if you DDOS the system. https://github.com/jart/cosmopolitan/blob/f10845ab9f847e4cad... You can't ban someone's IP without root. So we have two choices: (1) create…
    comment by jart · 2023-06-18 · in Redbean Systems
  21. I'd love to understand more about what the ".verynice()" call does. Source is here: https://github.com/jart/cosmopolitan/blob/f10845ab9f847e4cad... What are the effects of limiting a process priority?
    comment by maxmcd · 2023-06-18 · in Redbean Systems
  22. …which maintains support for old file formats. You can build and use it as follows: git clone https://github.com/jart/cosmopolitan cd cosmopolitan # cross-compile on x86-64-linux for x86-64 linux+windows+macos+freebsd+openbsd+netbsd make…
    comment by jart · 2023-06-06 · in GGML – AI at the Edge
  23. I bet it wouldn't be too extremely hard to port Vim to https://github.com/jart/cosmopolitan and run it without an OS (BIOS mode in cosmopolitan).
    comment by etaioinshrdlu · 2023-04-22 · in Boot to Vim, Vim as Pid 1 (2014)
  24. Cosmopolitan[0] is indeed worth mentioning here. It's an amazing project. [0] https://github.com/jart/cosmopolitan
    comment by loupol · 2023-02-12 · in How to create portable Linux binaries
  25. …Worth noting that we do have Google's outstanding double-conversion library in the cosmo codebase https://github.com/jart/cosmopolitan/tree/master/third_party... as well as gdtoa (which is what we use for printf's floating point support)…
  26. …appear to be. The comments in the code say it can do floats, but the comments are mistaken.) [1] https://github.com/jart/cosmopolitan/blob/master/libc/fmt/vc... [2] https://github.com/jart/cosmopolitan/issues/456
  27. …(a 'minimal vfprintf()') with the one in cosmopolitan starting at https://github.com/jart/cosmopolitan/blob/master/libc/stdio/... . Right away we can see nolibc places many functions in the same file while Cosmopolitan uses
  28. …I recommend obtaining Python from the Comsopolitan mono repo: git clone https://github.com/jart/cosmopolitan make -j8 o//third_party/python/python.com That'll easily give you a static Python 3.6 binary that can be run under Blink.
  29. …really nice `cosmocc` toolchain that makes building POSIX software with Cosmo easier than ever. See https://github.com/jart/cosmopolitan/blob/master/tool/script... and https://github.com/jart/cosmopolitan/blob/master/tool/script...
  30. …I wrote in C (with a focus on readability) which runs https://ipv4.games/ You can read the code at https://github.com/jart/cosmopolitan/blob/master/net/turfwar... This web server runs on a single VM. It was handling about 300 write…
  31. Cosmopolitan Libc uses a musl-cross-make toolchain. https://github.com/jart/cosmopolitan/tree/master/third_party... Its primary developer also runs Alpine. Cosmopolitan is closely related to Musl as far as C libraries go. You could think…
    comment by jart · 2022-12-15 · in Actually Portable Perl
  32. Another example: https://github.com/jart/cosmopolitan/issues/426
    comment by comex · 2022-11-10 · in Why is Rosetta 2 fast?
  33. But python is also universal? You can just bundle jc inside https://github.com/jart/cosmopolitan/tree/master/third_party... and it's as universal as it gets.
    comment by ElectricalUnion · 2022-11-03 · in JC – JSONifies the output of many CLI tools
  34. …rejoice. But it gets better. If you build Python in the Cosmopolitan Libc repository: git clone https://github.com/jart/cosmopolitan cd cosmopolitan build/bootstrap/make.com -j8 o//third_party/python/python.com Then you can use…
  35. Actually Portable Executables / Cosmopolitan https://justine.lol/ape.html https://github.com/jart/cosmopolitan
  36. Oh yes. A good place to start would be our c++ toolchain. https://github.com/jart/cosmopolitan/blob/master/tool/script...
    comment by jart · 2022-10-24 · in Debugging C with Cosmopolitan Libc
  37. …our system call support. Look here, all we need to support a XNU system call is 16-bits of a word. https://github.com/jart/cosmopolitan/blob/2.1/libc/sysv/sysc...
    comment by jart · 2022-09-21 · in Can I use a system call?
  38. Love your naming of the magic numbers headers. https://github.com/jart/cosmopolitan/blob/1.0/libc/sysv/cons...
    comment by davedx · 2022-09-21 · in Can I use a system call?
  39. ▲ 6
    Cosmopolitan v2.1
    story by jart · 2022-09-20 · 0 comments
  40. …to work here) Sadly, it was considered, and XFF is ignored from non-private source addresses: https://github.com/jart/cosmopolitan/blob/155b378a3962e4d291... With private addresses defined as: https://github.com/jart/cosmopolitan/blob/7ab15…
    comment by progval · 2022-09-11 · in IPv4 Turf War
  41. …anything other than educational purposes, at least not until they've been more battle tested. [0]: https://github.com/jart/cosmopolitan/issues/72
    comment by coder543 · 2022-09-08 · in Caddyhttp: Enable HTTP/3 by Default
  42. ▲ 5
    Cosmopolitan Supports Cross Platform GUI Sort Of. Good Progress so far.
    story by AMICABoard · 2022-09-06 · 0 comments
  43. https://github.com/jart/cosmopolitan/issues/140 https://github.com/golang/go/issues/51900 & from what I gather, APE is tightly-bound to x86_64, & depends on an embedded emulator for other architectures: > All we have to do embed an ARM…
    comment by georgia_peach · 2022-08-30 · in How fat does a fat binary need to be? (2021)
  44. https://github.com/jart/cosmopolitan/blob/master/ape/ape.S https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... We do everything static. Even on Apple x86 and M1.
  45. …to define kernel syscalls like how Cosmopolitan [0] uses for building things like RedBean [1]. 0. https://github.com/jart/cosmopolitan 1. https://redbean.dev/
  46. Don't forget the linker script: https://github.com/jart/cosmopolitan/blob/master/ape/ape.lds It has a longform explanation in the comment at the top.
    comment by jart · 2022-08-20 · in Cosmopolitan Libc v2.0
  47. …you're looking for a write-up/blog, however, if you haven't peeked at ape.S you absolutely must: https://github.com/jart/cosmopolitan/blob/master/ape/ape.S It is very commented, in a good way.
    comment by grimgrin · 2022-08-20 · in Cosmopolitan Libc v2.0
  48. ▲ 210
    Cosmopolitan Libc v2.0
    story by Orochikaku · 2022-08-20 · 34 comments
  49. ▲ 9
    Cosmopolitan v2.0 – build-once run-anywhere C library
    story by 3np · 2022-08-19 · 0 comments
  50. …at the moment. However we'd be happy to see them be included. Most of our modules e.g. unix https://github.com/jart/cosmopolitan/blob/master/third_party... only really depend on Lua and POSIX which is available everywhere. You can build…