diff options
| author | Harish Sadineni <Harish.Sadineni@windriver.com> | 2025-01-23 07:47:53 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-01 13:20:45 +0000 |
| commit | 166c3299b9f06cc1aca37c0b56be3abe11ab8107 (patch) | |
| tree | e6a08eba9d2a57c5c6f36c04c935b7a39b32ee93 | |
| parent | 2e2b3f69f2f5405ba823d3203edd113c002ad75b (diff) | |
| download | poky-166c3299b9f06cc1aca37c0b56be3abe11ab8107.tar.gz | |
rust: fix for rust multilib sdk configuration
YOCTO [#15061]
The rust sdk installs both 'rust.sh' and 'cargo.sh' for lib32 and lib64 in the same location.
This causes below error while installing the lib32 & lib64 binaries:
Error: Transaction test error:
file /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/cargo.sh
conflicts between attempted installs of rust-cross-canadian-arm-1.67.1-r0.x86_64_nativesdk and
rust-cross-canadian-aarch64-1.67.1-r0.x86_64_nativesdk
file /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/rust.sh
conflicts between attempted installs of rust-cross-canadian-arm-1.67.1-r0.x86_64_nativesdk and
rust-cross-canadian-aarch64-1.67.1-r0.x86_64_nativesdk
ERROR: Task (virtual:multilib:lib32:/media/build/poky/meta/recipes-sato/images/core-image-sato.bb:do_populate_sdk)
failed with exit code '1'
The change includes:
- Prepending '${RUST_TARGET_SYS}' to 'rust.sh' to differentiate between target systems.
- Moving the non-target-specific environment variables to 'nativesdk-cargo' and 'nativesdk-rust',
instead of being managed by the cross-canadian recipe.
(From OE-Core rev: 40eb4bfe2f100ba5301046ca25110fcc55a640bb)
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/rust/cargo_1.81.0.bb | 13 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-cross-canadian.inc | 10 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust_1.81.0.bb | 12 |
3 files changed, 26 insertions, 9 deletions
diff --git a/meta/recipes-devtools/rust/cargo_1.81.0.bb b/meta/recipes-devtools/rust/cargo_1.81.0.bb index 123032cdf7..db18ecfda9 100644 --- a/meta/recipes-devtools/rust/cargo_1.81.0.bb +++ b/meta/recipes-devtools/rust/cargo_1.81.0.bb | |||
| @@ -50,8 +50,21 @@ do_install:append:class-nativesdk() { | |||
| 50 | # sets to libdir but not base_libdir leading to symbol mismatches depending on the | 50 | # sets to libdir but not base_libdir leading to symbol mismatches depending on the |
| 51 | # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. | 51 | # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. |
| 52 | create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} | 52 | create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} |
| 53 | |||
| 54 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | ||
| 55 | mkdir "${ENV_SETUP_DIR}" | ||
| 56 | CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh" | ||
| 57 | |||
| 58 | cat <<- EOF > "${CARGO_ENV_SETUP_SH}" | ||
| 59 | # Keep the below off as long as HTTP/2 is disabled. | ||
| 60 | export CARGO_HTTP_MULTIPLEXING=false | ||
| 61 | |||
| 62 | export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt" | ||
| 63 | EOF | ||
| 53 | } | 64 | } |
| 54 | 65 | ||
| 66 | FILES:${PN} += "${base_prefix}/environment-setup.d" | ||
| 67 | |||
| 55 | # Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) | 68 | # Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) |
| 56 | # as shipped by Yocto Dunfell. | 69 | # as shipped by Yocto Dunfell. |
| 57 | # According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between | 70 | # According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between |
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc index 25c0e64ba1..846dde4dc6 100644 --- a/meta/recipes-devtools/rust/rust-cross-canadian.inc +++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc | |||
| @@ -54,15 +54,12 @@ do_install () { | |||
| 54 | 54 | ||
| 55 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | 55 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d |
| 56 | mkdir "${ENV_SETUP_DIR}" | 56 | mkdir "${ENV_SETUP_DIR}" |
| 57 | RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" | 57 | RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/${RUST_TARGET_SYS}_rust.sh" |
| 58 | 58 | ||
| 59 | RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` | 59 | RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` |
| 60 | RUST_HOST_TRIPLE=`echo ${RUST_HOST_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` | ||
| 61 | 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)} | ||
| 62 | 60 | ||
| 63 | cat <<- EOF > "${RUST_ENV_SETUP_SH}" | 61 | cat <<- EOF > "${RUST_ENV_SETUP_SH}" |
| 64 | export CARGO_TARGET_${RUST_TARGET_TRIPLE}_RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT" | 62 | export CARGO_TARGET_${RUST_TARGET_TRIPLE}_RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT" |
| 65 | export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}" | ||
| 66 | export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" | 63 | export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" |
| 67 | EOF | 64 | EOF |
| 68 | 65 | ||
| @@ -81,11 +78,6 @@ do_install () { | |||
| 81 | echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config" | 78 | echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config" |
| 82 | echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config" | 79 | echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config" |
| 83 | fi | 80 | fi |
| 84 | |||
| 85 | # Keep the below off as long as HTTP/2 is disabled. | ||
| 86 | export CARGO_HTTP_MULTIPLEXING=false | ||
| 87 | |||
| 88 | export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt" | ||
| 89 | EOF | 81 | EOF |
| 90 | } | 82 | } |
| 91 | 83 | ||
diff --git a/meta/recipes-devtools/rust/rust_1.81.0.bb b/meta/recipes-devtools/rust/rust_1.81.0.bb index b583508456..15ecbf74a0 100644 --- a/meta/recipes-devtools/rust/rust_1.81.0.bb +++ b/meta/recipes-devtools/rust/rust_1.81.0.bb | |||
| @@ -272,8 +272,20 @@ rust_do_install:class-nativesdk() { | |||
| 272 | rm ${D}${libdir}/rustlib/install.log | 272 | rm ${D}${libdir}/rustlib/install.log |
| 273 | rm ${D}${libdir}/rustlib/manifest* | 273 | rm ${D}${libdir}/rustlib/manifest* |
| 274 | rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so | 274 | rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so |
| 275 | |||
| 276 | ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d | ||
| 277 | mkdir "${ENV_SETUP_DIR}" | ||
| 278 | RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" | ||
| 279 | RUST_HOST_TRIPLE=`echo ${RUST_HOST_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` | ||
| 280 | 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)} | ||
| 281 | |||
| 282 | cat <<- EOF > "${RUST_ENV_SETUP_SH}" | ||
| 283 | export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}" | ||
| 284 | EOF | ||
| 275 | } | 285 | } |
| 276 | 286 | ||
| 287 | FILES:${PN} += "${base_prefix}/environment-setup.d" | ||
| 288 | |||
| 277 | EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" | 289 | EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" |
| 278 | rust_do_install:class-target() { | 290 | rust_do_install:class-target() { |
| 279 | export PSEUDO_UNLOAD=1 | 291 | export PSEUDO_UNLOAD=1 |
