[meta-lts-mixins][scarthgap/rust][PATCH 27/35] rust: export CARGO_BUILD_TARGET
Scott Murray <[email protected]> Fri, 31 Jul 2026 07:32:57 -0400
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <17484a886539be488f687c7e6f819e45b8f61987.1785496469.git.scott.murray@konsulko.com> |
From: Jesse Van Gavere <[email protected]> To cross compile a rust project with the SDK one currently has to know the associated target sys and run cargo build with it, by setting CARGO_BUILD_TARGET to the rust target sys, running cargo build after sourcing the SDK will immediately have the correct target. See https://doc.rust-lang.org/cargo/reference/config.html#buildtarget Signed-off-by: Adam Duskett <[email protected]> Signed-off-by: Jesse Van Gavere <[email protected]> Signed-off-by: Mathieu Dubois-Briand <[email protected]> (adapted from oe-core commit dc1a3a439c57c59578abbc474d10779de4d42c5a) Signed-off-by: Scott Murray <[email protected]> --- recipes-devtools/rust/rust-cross-canadian.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-devtools/rust/rust-cross-canadian.inc b/recipes-devtools/rust/rust-cross-canadian.inc index 4478a7e..5a152bd 100644 --- a/recipes-devtools/rust/rust-cross-canadian.inc +++ b/recipes-devtools/rust/rust-cross-canadian.inc @@ -59,6 +59,7 @@ do_install () { cat <<- EOF > "${RUST_ENV_SETUP_SH}" export CARGO_TARGET_${RUST_TARGET_TRIPLE}_RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT" + export CARGO_BUILD_TARGET="${RUST_TARGET_SYS}" export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" EOF -- 2.55.0