Skip to contentSkip to conversation

rust-cross-canadian: Fix file conflicts for 32 and 64 bit target architectures

PATCH In review [email protected] 2 participants 2 messages Nov 30, 2023 – Dec 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rust-cross-canadian: Fix file conflicts for 32 and 64 bit target architectures

From: Deepthi Hemraj <[email protected]>

[YOCTO #15061]
Rust multilib sdks broken because of the conflicts between attempted installs of rust-cross-canadian for 32 and 64 bit target architectures 32 and 64 bit target architectures are trying to install cargo.sh and rust.sh in the same path which resulted in the issue.

The current patch checks for the 32 and 64 bit target architectures and modifies CARGO_ENV_SETUP_SH and RUST_ENV_SETUP_SH macros. Hence, it creates different file names for the environment setup scripts and resolves the issue.

---
 meta/recipes-devtools/rust/rust-cross-canadian.inc | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
meta/recipes-devtools/rust/rust-cross-canadian.inc +12 -2
index 7bfef6d175..7153a59a9d 100644
@@ -52,7 +52,12 @@ do_install () {
 
     ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
     mkdir "${ENV_SETUP_DIR}"
-    RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
+
+    if echo "${TARGET_ARCH}" | grep -q "64"; then
+        RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
+    else
+        RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust-32.sh"
+    fi
 
     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'`
@@ -66,7 +71,12 @@ do_install () {
 
     chown -R root.root ${D}
 
-    CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
+    if echo "${TARGET_ARCH}" | grep -q "64"; then
+        CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
+    else
+        CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-32.sh"
+    fi
+
     cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
 	export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
 	mkdir -p "\$CARGO_HOME"
Signature · 1 line
2.42.0
#1 lore raw

meta/recipes-devtools/rust/rust-cross-canadian.inc do_install () { · line 60

Quoted 5 lines · Deepthi via lists.openembedded.org
meta/recipes-devtools/rust/rust-cross-canadian.inc +5 -0
+    if echo "${TARGET_ARCH}" | grep -q "64"; then
+        RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
+    else
+        RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust-32.sh"
+    fi

If you really must look at the host word size then inherit siteinfo and use SITEINFO_BITS.

However, the usual solution here is for multilib recipes to use ${MLPREFIX}.

Ross