cargo-zigbuild
🚀 Help me to become a full-time open-source developer by sponsoring me on GitHub
Compile Cargo project with zig as linker for easier cross compiling.
Installation
cargo install cargo-zigbuild
You can also install it using pip which will also install ziglang automatically:
pip install cargo-zigbuild
We also provide a Docker image which has macOS SDK pre-installed in addition to cargo-zigbuild and Rust, for example to build for x86_64 macOS:
docker run --rm -it -v $(pwd):/io -w /io messense/cargo-zigbuild \
cargo zigbuild --release --target x86_64-apple-darwin
Usage
- Install zig following the official documentation,
on macOS, Windows and Linux you can also install zig from PyPI via
pip3 install ziglang - Install Rust target via rustup, for example,
rustup target add aarch64-unknown-linux-gnu - Run
cargo zigbuild, for example,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
Caveats
- Currently only Linux, macOS and Windows gnu targets are supported, other target platforms can be added if you can make it work, pull requests are welcome.
- Only current Rust stable and nightly versions are regularly tested on CI, other versions may not work.
Known upstream zig issues:
- zig cc: parse
-targetand-mcpu/-march/-mtuneflags according to clang: Some Rust targets aren't recognized byzig cc, for examplearmv7-unknown-linux-gnueabihf - glibc 2.27 or older: fcntl64 not found, but zig's glibc headers refer it
License
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.
Metadata
Release files for cargo-zigbuild 0.12.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| cargo_zigbuild-0.12.1-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| cargo_zigbuild-0.12.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| cargo_zigbuild-0.12.1-py3-none-win32.whl | Python 3 | none | Windows x86-32 | Details |
| cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl | Python 3 | none | Linux glibc 2.17+ ARMv7l | Details |
| cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64 | Details |
| cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl | Python 3 | none | Linux glibc 2.5+ x86-32 | Details |
| cargo_zigbuild-0.12.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl | Python 3 | none | macOS 10.9+ x86-64, macOS 10.9+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 | Details |
Total release size: 6.1 MB
Release files / cargo_zigbuild-0.12.1-py3-none-win_arm64.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-win_arm64.whl |
|---|---|
| Size | 607.1 kB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
58beff7c0cbef149cdafa1f561f5ae6840cb276036d66c93388bf23ecc13ca48
|
|
BLAKE2b-256 checksum How to use checksums |
fc3622798c433f7a008a75c074ed949c7f80ed9cf15375169062fde7d193ed22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-win_amd64.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-win_amd64.whl |
|---|---|
| Size | 634.9 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b0563ada5fd9e097e0e52620a7f3a8e6ba1ec465d23fbf38a2374da71d39f102
|
|
BLAKE2b-256 checksum How to use checksums |
5a07ea89a46bbc10ed8c064031eb428b37998c7ff6049eebf20a221cfe84923c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-win32.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-win32.whl |
|---|---|
| Size | 600.5 kB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
c8f2b20624a7d56f0947548de71af83341210aa57b552f0a9098ce13f4166d9a
|
|
BLAKE2b-256 checksum How to use checksums |
35c12936cd059dbd3c1010ab3ef0c501e8044a3f87c9ce5cbf18319c67db1b38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 664.1 kB |
| Tags | Linux glibc 2.17+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
a0a7fcc14f41d89bec01763dc11f666b82a96d215808d37ea9cf3f7d36c05d4d
|
|
BLAKE2b-256 checksum How to use checksums |
004334a1d055fe6e1f660ef9a7178d307f63356dc935df86cf497b73e468f0c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 688.5 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
ebfd134a7baefed476b5f99ca4eec41e0380a991ad5d98be8aa2edcdf9da7604
|
|
BLAKE2b-256 checksum How to use checksums |
e15adeb5f5e7b55d60e22b513c064c9d812a7abb134a0603ad08ce09c9dde23e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
|---|---|
| Size | 740.9 kB |
| Tags | Linux glibc 2.5+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
7850981bc982f78aa8857bf6dd515743d136615ff07f35c006e92d1c8484878f
|
|
BLAKE2b-256 checksum How to use checksums |
8218a5c0bb0fb6ed360255fd5c166e876450a69a50effae8960c9e252c781909
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl |
|---|---|
| Size | 776.9 kB |
| Tags | Linux glibc 2.5+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
6f1bc8cd9f2df712d2536ded7d2721afc2a493fd83c1a545859c12979fe790f8
|
|
BLAKE2b-256 checksum How to use checksums |
c9bbf678602b60d75245a20d69b06da2c711b40f72fdedd2c1ba262d79dcb9e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / cargo_zigbuild-0.12.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
| Download URL | cargo_zigbuild-0.12.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
cc8a376f410e1b1b7d5281cb4bf636da918436fc42ffff0968a3899ddc6c15ce
|
|
BLAKE2b-256 checksum How to use checksums |
fa0754c538829aa746d0f776241502632c60fa9455eb924e872c67838a4c5901
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|