Julia without libc (or bundled with non-glibc)

What does it take to run Julia without libc? Not fully baremetal, might be a later goal…

Very few languages run without libc, e.g. glibc. Zig is an exception but also works with.

One option is to bundle with another libc such as this one where I see:

Compared with glibc, you should expect Cosmopolitan to be almost as fast, but with an order of a magnitude tinier code size. […]
In the case of the most important libc function, memcpy(), Cosmopolitan outperformed every other open source library tested. […] What makes Cosmopolitan so fast here is it uses uses several different memory copying strategies.

I was watching a Linus Torvalds video where he claimed glibc is a hindrance to binary executables on desktop Linux (i.e. they’re not bug-compatible, changing the API). Is glibc the only dependency (besides the kernel itself) that’s not statically linked?

With Julia having musl support, implicit is that the default build is using glibc (and in neither case not bundled with).

That library, Cosmopolitan, is also much smaller than musl, so I’m curous what people may be missing out on, or if Julia could work with it.

In short, what does Julia require from libc? Also malloc etc. nothing I can’t imagine not provided, but in general I’m curious what’s the need for libc rather than (calling straight to the kernal; e.g. for allocation and) doing your own memory handling. The locale system is simplified in musl (almost only UTF-8), does it do much for Julia that Julia already doesn’t take care of?

1 Like

Looking into Cosmopolitan I noticed a language I hadn’t heard of, a rare female named one, Janet, and this fork is 5 commits ahead, this one seemingly the only one to make it work:

Think Lua or Guile.

Surprising in a libc:

I was also a bit surprised to see these files (in a a libc), new sorting algorithm? https://github.com/jart/cosmopolitan/blob/master/libc/runtime/carsort100.c