This will enable us to build and run rust programs on the sdk host.

% cargo run --target x86_64-oesdk-linux-gnu -vv
       Fresh hello v0.1.0 (~/development/hello)
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running 
`/usr/local/sdk/sysroots/x86_64-oesdk-linux/lib/ld-linux-x86-64.so.2 
target/x86_64-oesdk-linux-gnu/debug/hello`
Hello, world

Signed-off-by: Sean Nyekjaer <[email protected]>
---
 meta/recipes-devtools/rust/rust-cross-canadian.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc 
b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index d25646237c..5b89216658 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -55,9 +55,12 @@ do_install () {
     RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
 
     RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]' '[:upper:]' | 
sed 's/-/_/g'`
+    RUST_HOST_TRIPLE=`echo ${RUST_HOST_SYS} | tr '[:lower:]' '[:upper:]' | sed 
's/-/_/g'`
+    SDKARCH=`echo ${SDK_ARCH} | sed 's/_/-/g'`
 
     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_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/ld-linux-${SDKARCH}.so.2"
        export 
RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
        EOF
 
-- 
2.42.0

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

Reply via email to