Hello @L9QHFnQ5wg, welcome to the forum.
The answer is yes, you can call any c compiler from the zig build system.
But don’t expect the zig toolkit cross compilation benefits when you only use it for building.
To understand the zig toolkit cross compile benefits you need to try to cross compile the following trivial C code. Try to cross compile it using any toolkit, to a machine with different operating system and/or different architecture.
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
With zig you just need to download one toolkit and you can compile to: Windows, macOS or Linux for any supported CPU.
e.g.
zig cc hello.c -target aarch64-linux-musl
zig cc hello.c -target aarch64-linux-gnu
zig cc hello.c -target x86_64-windows-msvc
With clang you can compile for the same OS only and different architecture and you cannot link, because either you are missing the other OS include file or the other OS and/or architecture libraries.
With gcc you need a different toolkit for each target, and you are going to have the same problems with clang.
Go and rust languages have wonderful cross compile functionality unless you need a C library, then your best bet is to just use the zig toolkit to help them cross compile.
rust: Zig Makes Rust Cross-compilation Just Work · Um, actually...
go: Zig Makes Go Cross Compilation Just Work - DEV Community
why: `zig cc`: a Powerful Drop-In Replacement for GCC/Clang - Andrew Kelley