How to use pixi-managed rust to use zigbuild for cross-compilation #5246
amirhosseindavoody
started this conversation in
General
Replies: 1 comment 1 reply
-
|
unfortunately conda-forge rust doesnt support cross compilation targets because it doesnt use rustup. your options:
[dependencies]
# remove rust from pixi deps
cargo-zigbuild = "*"then install rust with rustup separately: curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add x86_64-unknown-linux-musl
[dependencies]
rust-nightly = "*"then: cargo +nightly zigbuild -Z build-std --target x86_64-unknown-linux-musl
cargo install cross
cross build --target x86_64-unknown-linux-muslthe fundamental issue is conda-forge rust is standalone binary without rustup toolchain management. for cross compilation rustup is better choice |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Summary
I am building a rust code and using pixi to manage environment dependencies such as rust. I want to use zigbuild to cross compile to
x86_64-unknown-linux-musl.When attempting to build static musl binaries using
cargo-zigbuild, the build failed with:Root Cause
The issue stems from using conda-forge managed Rust (via pixi) instead of rustup-managed Rust:
Conda-forge Rust only ships with the standard library for the host platform (
x86_64-unknown-linux-gnu). It does not include pre-compiled standard libraries for cross-compilation targets likex86_64-unknown-linux-musl.cargo-zigbuildprovides Zig as a cross-compiler/linker (which includes musl libc), but it still requires the Rust standard library (core,std,alloc, etc.) pre-compiled for the target platform.rustup target addis not available because conda-forge Rust doesn't use rustup - it's a standalone installation.-Zbuild-std(which compiles the standard library from source) requires nightly Rust, but conda-forge only provides stable Rust.Question
Is there anyway to use pixi-managed rust with zigbuild or the thing that I am trying to do is impossible right now.
Beta Was this translation helpful? Give feedback.
All reactions