Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 2 participants 2 messages Nov 8, 2023

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rust-cross-canadian: Fix file conflicts for arm and aarch64

From: Deepthi Hemraj <[email protected]>

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

---
 .../rust/rust-cross-canadian.inc              | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
meta/recipes-devtools/rust/rust-cross-canadian.inc +25 -0
index 7bfef6d175..94c3b0d696 100644
@@ -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
+	RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.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'`
     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)}
@@ -67,6 +79,19 @@ do_install () {
     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"
+    # Set up environment variables for ARM
+    elif [ "${TARGET_ARCH}" == "arm" ]; then
+	CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-arm.sh"
+	CARGO_TARGET_SYS="arm-unknown-linux-gnueabi"
+    else
+	CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.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
Quoted 21 lines · Deepthi via lists.openembedded.org

From: Deepthi Hemraj <[email protected]>

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

---
 .../rust/rust-cross-canadian.inc              | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
meta/recipes-devtools/rust/rust-cross-canadian.inc +0 -0
index 7bfef6d175..94c3b0d696 100644

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

Quoted 5 lines
meta/recipes-devtools/rust/rust-cross-canadian.inc +2 -0
@@ -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

change this check to '='

Quoted 14 lines
meta/recipes-devtools/rust/rust-cross-canadian.inc +10 -0
+       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
+       RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.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'`
     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)}

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

Quoted 10 lines
meta/recipes-devtools/rust/rust-cross-canadian.inc +7 -0
@@ -67,6 +79,19 @@ do_install () {
     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"
+    # Set up environment variables for ARM
+    elif [ "${TARGET_ARCH}" == "arm" ]; then

same here

Quoted 21 lines
meta/recipes-devtools/rust/rust-cross-canadian.inc +6 -1
+       CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo-arm.sh"
+       CARGO_TARGET_SYS="arm-unknown-linux-gnueabi"
+    else
+       CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
+    fi
+
     cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
        export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
        mkdir -p "\$CARGO_HOME"
--

2.42.0

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