4 ms·
zig has a cross-compiler frontend (zig cc) which can be used as a drop-in replacement for a custom sysroot + binutils + gcc for several platforms. I've used it
by chris_armstrong 1y ago
zig has a cross-compiler frontend (zig cc) which can be used as a drop-in replacement for a custom sysroot + binutils + gcc for several platforms. I've used it to build OCaml cross-compilers that only depend on zig itself (https://www.chrisarmstrong.dev/posts/ocaml-cross-compilation-an-experiment https://www.chrisarmstrong.dev/posts/ocaml-cross-compilation...).
There are other projects that have used it in a similar way too.
[1] https://actually.fyi/posts/zig-makes-rust-cross-compilation-just-work/ https://actually.fyi/posts/zig-makes-rust-cross-compilation-...
[2] https://jcbhmr.com/2024/07/19/zig-cc-cmake/ https://jcbhmr.com/2024/07/19/zig-cc-cmake/
- olivia-banks 1y agoInteresting. OCaml cross compilation scared me the one time I considered it, so it's nice to know this is an option. I will be pedantic and say it isn't a replacement for a custom sysroot/binutils/whatnot, since it really just papers over those user-facing details by shipping a prebuilt collection of sysroots and using LLD. They sorta get this for free since they need it for cross-compiling Zig code anyways.