diff mbox series

[meta-lts-mixins,scarthgap/rust,22/29] rust: Fix build failure when multilibs are enabled

Message ID 0901b65272b370bae8d2a9cd1131e4016bf25de0.1744061149.git.scott.murray@konsulko.com
State New
Headers show
Series Update to Rust 1.85.1 | expand

Commit Message

Scott Murray April 7, 2025, 9:30 p.m. UTC
From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>

When multilibs are enabled, building rust is failing because of the following commit
https://github.com/rust-lang/rust/commit/68034f837a39387e49fc7d7c5b088f5372a1127e
with stage1/rustc cannot able to find dependent *.so files. The issue is
been fixed inrust-master with the following commit by passing the necessary library
paths before executing stage1/rustc

Upstream-Status: Backport [https://github.com/rust-lang/rust/commit/139d6ba054a1a4cc5fe64981ad46fd5547bd4916]

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit ab29b970ba7e08eabca92018d103af5f249ed2c5)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 .../Zdual-proc-macros-additional-check.patch  | 31 +++++++++++++++++++
 recipes-devtools/rust/rust-source.inc         |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 recipes-devtools/rust/files/Zdual-proc-macros-additional-check.patch
diff mbox series

Patch

diff --git a/recipes-devtools/rust/files/Zdual-proc-macros-additional-check.patch b/recipes-devtools/rust/files/Zdual-proc-macros-additional-check.patch
new file mode 100644
index 0000000..6bb1738
--- /dev/null
+++ b/recipes-devtools/rust/files/Zdual-proc-macros-additional-check.patch
@@ -0,0 +1,31 @@ 
+Fix bootstrap failure when multilibs are enabled.
+
+Upstream-Status: Backport [https://github.com/rust-lang/rust/commit/139d6ba054a1a4cc5fe64981ad46fd5547bd4916]
+
+Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
+---
+diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
+index 066e6bf53f..a2f6fac4b1 100644
+--- a/src/bootstrap/src/core/builder/cargo.rs
++++ b/src/bootstrap/src/core/builder/cargo.rs
+@@ -646,7 +646,10 @@ impl Builder<'_> {
+                 // Build proc macros both for the host and the target unless proc-macros are not
+                 // supported by the target.
+                 if target != compiler.host && cmd_kind != Kind::Check {
+-                    let error = command(self.rustc(compiler))
++                    let mut rustc_cmd = command(self.rustc(compiler));
++                    self.add_rustc_lib_path(compiler, &mut rustc_cmd);
++
++                    let error = rustc_cmd
+                         .arg("--target")
+                         .arg(target.rustc_target_arg())
+                         .arg("--print=file-names")
+@@ -654,6 +657,7 @@ impl Builder<'_> {
+                         .arg("-")
+                         .run_capture(self)
+                         .stderr();
++
+                     let not_supported = error
+                         .lines()
+                         .any(|line| line.contains("unsupported crate type `proc-macro`"));
+
diff --git a/recipes-devtools/rust/rust-source.inc b/recipes-devtools/rust/rust-source.inc
index 28f5aeb..ee23e5a 100644
--- a/recipes-devtools/rust/rust-source.inc
+++ b/recipes-devtools/rust/rust-source.inc
@@ -7,6 +7,7 @@  SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
             file://oeqa-selftest-Increase-timeout-in-process-sigpipe-ru.patch;patchdir=${RUSTSRC} \
             file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \
 	    file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \
+	    file://Zdual-proc-macros-additional-check.patch;patchdir=${RUSTSRC} \
 "
 SRC_URI[rust.sha256sum] = "e23ec747a06ffd3e94155046f40b6664ac152c9ee3c2adfd90353a7ccff24226"