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]>
---
 meta/recipes-devtools/rust/rust-cross-canadian.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc 
b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index df8b78d326..f083bcda82 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/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.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#237632): 
https://lists.openembedded.org/g/openembedded-core/message/237632
Mute This Topic: https://lists.openembedded.org/mt/119509535/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to