rust: Fix multiple rlib conflict when building with rust and libstd-rs
PATCH 1/1 rust: Fix multiple rlib conflict when building with rust and libstd-rs
From: Yash Shinde <[email protected]>
When building an image with IMAGE_INSTALL:append = ' rust libstd-rs', a conflict arises due to multiple candidates for the rlib dependency std. This results in the following error:
error[E0464]: multiple candidates for rlib dependency std found
|
= note: candidate #1: /usr/lib/rustlib/x86_64-poky-linux-gnu/lib/libstd-20c3de2d9292cd03.rlib = note: candidate #2: /usr/lib/rustlib/x86_64-poky-linux-gnu/lib/libstd.so
The issue seems to be from an extra copy of the rlib as both the recipes generate the same rlibs, causing conflicts when using std lib to compile rust programs in the image.
Remove the redundant rlib copy ensuring only the necessary rlib is present and prevent the conflict.
--- meta/recipes-devtools/rust/rust_1.81.0.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust_1.81.0.bb +2 -0
@@ -272,6 +272,7 @@ rust_do_install:class-nativesdk() { rm ${D}${libdir}/rustlib/install.log rm ${D}${libdir}/rustlib/manifest* rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so + rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd-*.rlib ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d mkdir "${ENV_SETUP_DIR}"
@@ -310,6 +311,7 @@ rust_do_install:class-target() { rm ${D}${libdir}/rustlib/install.log rm ${D}${libdir}/rustlib/manifest* rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so + rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd-*.rlib } addtask do_update_snapshot after do_patch
Signature · 1 line
2.43.0
Quoted 36 lines · Yash Shinde via lists.openembedded.org
From: Yash Shinde <[email protected]>
When building an image with IMAGE_INSTALL:append = ' rust libstd-rs', a conflict arises due to multiple candidates for the rlib dependency
std. This results in the following error:error[E0464]: multiple candidates for
rlibdependencystdfound
|
= note: candidate #1:/usr/lib/rustlib/x86_64-poky-linux-gnu/lib/libstd-20c3de2d9292cd03.rlib= note: candidate #2:/usr/lib/rustlib/x86_64-poky-linux-gnu/lib/libstd.soThe issue seems to be from an extra copy of the rlib as both the recipes generate the same rlibs, causing conflicts when using std lib to compile rust programs in the image.
Remove the redundant rlib copy ensuring only the necessary rlib is present and prevent the conflict.
Signed-off-by Yash Shinde <[email protected]>---
meta/recipes-devtools/rust/rust_1.81.0.bb | 2 ++1 file changed, 2 insertions(+)meta/recipes-devtools/rust/rust_1.81.0.bb +0
-0@@ -272,6 +272,7 @@ rust_do_install:class-nativesdk() {rm ${D}${libdir}/rustlib/install.log
rm ${D}${libdir}/rustlib/manifest*
rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so + rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd-*.rlib
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d mkdir "${ENV_SETUP_DIR}"meta/recipes-devtools/rust/rust_1.81.0.bb +0
-0@@ -310,6 +311,7 @@ rust_do_install:class-target() {
Quoted 7 lines
rm ${D}${libdir}/rustlib/install.log
rm ${D}${libdir}/rustlib/manifest*
rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd*.so + rm ${D}${libdir}/rustlib/${RUST_HOST_SYS}/lib/libstd-*.rlib }
addtaskdo_update_snapshotafterdo_patch
This seems to cause build failures, e.g:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/19/builds/962/steps/11/logs/stdio
"error[E0463]: can't find crate for std"
Cheers,
Richard