diff mbox series

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

Message ID 20231130090751.3654747-1-Deepthi.Hemraj@windriver.com
State New
Headers show
Series rust-cross-canadian: Fix file conflicts for 32 and 64 bit target architectures | expand

Commit Message

Deepthi H Nov. 30, 2023, 9:07 a.m. UTC
From: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>

[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.

Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
---
 meta/recipes-devtools/rust/rust-cross-canadian.inc | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Ross Burton Dec. 13, 2023, 10:37 a.m. UTC | #1
On 30 Nov 2023, at 09:07, Hemraj, Deepthi via lists.openembedded.org <Deepthi.Hemraj=windriver.com@lists.openembedded.org> wrote:
> +    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
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 7bfef6d175..7153a59a9d 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -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"