diff mbox series

[V2] rust-cross-canadian: Fix file conflicts for arm and aarch64

Message ID 20231108102045.3190366-1-Deepthi.Hemraj@windriver.com
State New
Headers show
Series [V2] rust-cross-canadian: Fix file conflicts for arm and aarch64 | expand

Commit Message

Deepthi H Nov. 8, 2023, 10:20 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 arm and aarch64.

Arm and aarch64 target architectures are trying to install cargo.sh and rust.sh in the same path which resulted in the issue.

The current patch modifies CARGO_ENV_SETUP_SH and RUST_ENV_SETUP_SH macros based on the architecture.
Hence, creates different file names for the environment setup scripts and resolves the issue.

Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
---
 .../rust/rust-cross-canadian.inc              | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

Comments

Ross Burton Nov. 23, 2023, 12:40 p.m. UTC | #1
On 8 Nov 2023, at 10:20, Hemraj, Deepthi via lists.openembedded.org <Deepthi.Hemraj=windriver.com@lists.openembedded.org> wrote:
> +    # Set up environment variables for AArch64
> +    if [ "${TARGET_ARCH}" = "aarch64" ]; then
> + CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-aarch64.sh"
> + CARGO_TARGET_SYS="aarch64-unknown-linux-gnu"
> +    elif [ "${TARGET_ARCH}" = "arm" ]; then
> + CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-arm.sh"
> + CARGO_TARGET_SYS="arm-unknown-linux-gnueabi"
> +    else
> + echo "Unsupported TARGET_ARCH: ${TARGET_ARCH}"
> +    fi

Why does this restrict rust-cross-canadian to arm/aarch64?  x86-64 isn’t unsupported and presumably a x86/x86-64 multilib setup will fail the same way?

Ross
Deepthi H Nov. 30, 2023, 11:41 a.m. UTC | #2
Hi Ross,

Thanks for reviewing the patch and your suggestion.

>> Why does this restrict rust-cross-canadian to arm/aarch64?
Please find the patch at following link that fixes the conflicts for arm64 and x86-64.
https://lists.openembedded.org/g/openembedded-core/message/191481

Thanks,
Deepthi
From: Ross Burton<mailto:Ross.Burton@arm.com>
Sent: Thursday, November 23, 2023 6:10 PM
To: Hemraj, Deepthi<mailto:Deepthi.Hemraj@windriver.com>
Cc: OE Core mailing list<mailto:openembedded-core@lists.openembedded.org>; MacLeod, Randy<mailto:Randy.MacLeod@windriver.com>; Gowda, Naveen<mailto:Naveen.Gowda@windriver.com>; Moodalappa, Shivaprasad<mailto:Shivaprasad.Moodalappa@windriver.com>; Kokkonda, Sundeep<mailto:Sundeep.Kokkonda@windriver.com>; Khem Raj<mailto:raj.khem@gmail.com>
Subject: Re: [OE-core] [PATCH V2] rust-cross-canadian: Fix file conflicts for arm and aarch64

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

On 8 Nov 2023, at 10:20, Hemraj, Deepthi via lists.openembedded.org <Deepthi.Hemraj=windriver.com@lists.openembedded.org> wrote:
> +    # Set up environment variables for AArch64
> +    if [ "${TARGET_ARCH}" = "aarch64" ]; then
> + CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-aarch64.sh"
> + CARGO_TARGET_SYS="aarch64-unknown-linux-gnu"
> +    elif [ "${TARGET_ARCH}" = "arm" ]; then
> + CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-arm.sh"
> + CARGO_TARGET_SYS="arm-unknown-linux-gnueabi"
> +    else
> + echo "Unsupported TARGET_ARCH: ${TARGET_ARCH}"
> +    fi

Why does this restrict rust-cross-canadian to arm/aarch64?  x86-64 isn’t unsupported and presumably a x86/x86-64 multilib setup will fail the same way?

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..9efc2389bb 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -54,6 +54,18 @@  do_install () {
     mkdir "${ENV_SETUP_DIR}"
     RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
 
+    # Set up environment variables for AArch64
+    if [ "${TARGET_ARCH}" = "aarch64" ]; then
+	RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust-aarch64.sh"
+	RUST_TARGET_SYS="aarch64-unknown-linux-gnu"
+    # Set up environment variables for ARM
+    elif [ "${TARGET_ARCH}" = "arm" ]; then
+	RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust-arm.sh"
+	RUST_TARGET_SYS="arm-unknown-linux-gnueabi"
+    else
+	echo "Unsupported TARGET_ARCH: ${TARGET_ARCH}"
+    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'`
     SDKLOADER=${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('SDK_ARCH', 'ppc64le', 'ld64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'riscv64', 'ld-linux-riscv64-lp64d.so.1', '', d)}
@@ -65,8 +77,19 @@  do_install () {
 	EOF
 
     chown -R root.root ${D}
-
     CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
+
+    # Set up environment variables for AArch64
+    if [ "${TARGET_ARCH}" = "aarch64" ]; then
+	CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-aarch64.sh"
+	CARGO_TARGET_SYS="aarch64-unknown-linux-gnu"
+    elif [ "${TARGET_ARCH}" = "arm" ]; then
+	CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-arm.sh"
+	CARGO_TARGET_SYS="arm-unknown-linux-gnueabi"
+    else
+	echo "Unsupported TARGET_ARCH: ${TARGET_ARCH}"
+    fi
+
     cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
 	export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
 	mkdir -p "\$CARGO_HOME"