3 comments

[ 2.5 ms ] story [ 22.4 ms ] thread
Lots of this is also thanks to LLVM being much more friendlier to cross compilation than other compiler infrastructures (for instance, GCC requires a different compiler for every target, which is ridiculous IMHO). Usually every build of LLVM can generate code for every target LLVM supports, and not only the default one, and MC and LLD can replace the need of another instance of binutils too.

Also, while Rust's cross compiling facilities are nice, they are no match for Zig and especially Go.

To me, it doesn't seem like it is LLVM doing the heavy-lifting as much as Docker/Podman (which are used through Cross). Maybe I am missing something...

I definitely agree with you that Zig and Go handle cross-compiling much nicer than the workarounds mentioned in this article. Personally, I prefer the cross-compilation mechanics of Zig over Go.

With a GCC-based toolchain, you need to build binutils and GCC for each target you need, plus a sysroot with headers and libraries to target.

With LLVM, the same backend and set of tools can target every single platform LLVM supports, and they also ship their binutils equivalents. Thus, rust in this case could probably be also C or C++; the infrastructure is the same. Rust has also the perk of having a nicer build system and tools that do not require you to lose your sanity in order to cross compile something, which is nice.