diff mbox series

[meta-lts-mixins,scarthgap/rust,27/35] rust: export CARGO_BUILD_TARGET

Message ID 17484a886539be488f687c7e6f819e45b8f61987.1785496469.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.96.1 | expand

Commit Message

Scott Murray July 31, 2026, 11:32 a.m. UTC
From: Jesse Van Gavere <jesse.vangavere@teledyne.com>

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 <adam.duskett@amarulasolutions.com>
Signed-off-by: Jesse Van Gavere <jesse.vangavere@teledyne.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
(adapted from oe-core commit dc1a3a439c57c59578abbc474d10779de4d42c5a)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 recipes-devtools/rust/rust-cross-canadian.inc | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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