Introduction
h
Compile Cargo project with zig as linker for easier cross compiling.
Installation
cargo install cargo-zigbuild
Build
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