Skip to content

Instantly share code, notes, and snippets.

@PancakeTAS
PancakeTAS / README.md
Last active November 11, 2025 18:05
A GNU-less Sysroot: Compiling LLVM to run with musl, libc++ and compiler-rt

This gist shows how to get a fully working LLVM build that runs in a separate sysroot, completely free of any GNU tools. I achieved this by substituting glibc with musl, libstdc++ with libc++ and gcc-libs with compiler-rt. I can't say anything about the stability of this system (as far as I know libc++ is far from finished), but it was fun to get here.

Let's get started. For this, I'll assume you have a fully working LLVM compiler (clang) as well as LLVM linker (lld) on your system. I myself am on Artix Linux currently, and I'm running clang-19.1.7-2 and llvm-19.1.7-2.

First, let's grab all the resources we need: