How could I get clang with musl into fresh linux distribution?


I’ve been excited about possibility to make it easier to create linux distribution from scratch. For that I’ve been working on a study linux distribution that I call lelux:

If I wanted to get my distribution further than this I should get a compiler inside the distribution. I suppose clang would be easy target because it’s well-structured and based on LLVM, which is itself really sane project. I would also like if it used musl instead of glibc.

So, how could I compile myself a clang, which compiles software with musl, and would work within a really bare linux distribution, such as the one I made with handful of system files?

I’ve seen and tried but I wonder if things have changed since that page was written.

Hi, My distribution of clang/LLVM () uses musl. It would be very interesting to build your Linux kernel using clang as they are doing at -Rich

--- end quoted text ---

Hi Henri,
Hopefully you already know there already is a linux from scratch.

I can tell you that project is vibrant and very useful in designing minimal,
customized linux distributions. It is very educational to work with it. Appears
you just want to use the clang/llvm tool chain. All the answers you need follow
from understanding the tool chain linuxfromscratch uses. They do an excellent job
of highlighting the intricacies of the tool chain and the dependencies on the
minimal distribution. For example, the order to build such packages and how to
bootstrap the compiler.

If I were you, I would start there. And then just swap out the tool chains in
an iterative way. Obviously you are going to have to take responsibility for
modifying the build scripts to work with clang and llvm. I think your biggest
problem will be in building the linux kernel.