TL;DR Here’s my work so far. Help me fix the remaining issues!
Users of musl-based Linux distributions like Alpine can’t use our Linux releases of rustc because those are compiled for
x86_64-unknown-linux-gnu and require having glibc installed to work. Having releases of rustc for
x86_64-unknown-linux-musl would fix that issue as they can be used on any (x86_64) Linux system regardless of it libc election.
Some time ago I managed to build rustc for
x86_64-unknown-linux-musl. But the rustc I built didn’t really work.
rustc -V worked fine but trying to compile anything resulted in a segfault. According to the gdb backtrace, the source of the segfault was a strlen call with null pointer argument somewhere inside LLVM.
The solution may require patching LLVM (I’m already using some of Alpine’s patches, maybe we need to apply the other patches?). Unfortunately, I don’t have much time to look into this issue. So I’m sharing my work here with the hope that someone might be able to pick it up and solve the issue. If someone does, let me know! Then we can work together to upstream the necessary changes .