https://github.com/rust-cross/cargo-zigbuild Github Repo Stars: rust-cross/cargo-zigbuild

Compile Cargo project with zig as linker for easier cross compiling.

cargo install cargo-zigbuild

Cross build

cargo zigbuild --target x86_64-unknown-linux-musl
cargo zigbuild --target aarch64-unknown-linux-gnu

Specify glibc version

cargo zigbuild supports passing glibc version in --target option, for example, to compile for glibc 2.17 with the aarch64-unknown-linux-gnu target:

cargo zigbuild --target aarch64-unknown-linux-gnu.2.17

macOS universal2 target

cargo zigbuild --target universal2-apple-darwin