diff mbox series

[meta-lts-mixins,kirkstone/rust,04/11] rust: Fix assertion failure error on oe-selftest

Message ID 20240311162419.1138625-4-jose.quaresma@foundries.io
State New
Headers show
Series [meta-lts-mixins,kirkstone/rust,01/11] rust: Fetch cargo from rust-snapshot dir. | expand

Commit Message

Jose Quaresma March 11, 2024, 4:24 p.m. UTC
From: Yash Shinde <Yash.Shinde@windriver.com>

Fixes: thread 'main' panicked at 'assertion failed: `(left == right)`
       left: `x86_64-unknown-linux-gnu`,
       right: `x86_64-poky-linux-gnu`: Cannot obtain compiler for non-native build triple at stage 0', compile.rs:1474:13

Add correct target value for cross-compiled targets on stage1 during rust oe-selfest.

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 .../rust/files/target-build-value.patch       | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 recipes-devtools/rust/files/target-build-value.patch
diff mbox series

Patch

diff --git a/recipes-devtools/rust/files/target-build-value.patch b/recipes-devtools/rust/files/target-build-value.patch
new file mode 100644
index 0000000..23e8c76
--- /dev/null
+++ b/recipes-devtools/rust/files/target-build-value.patch
@@ -0,0 +1,26 @@ 
+Add correct build value for cross-compiled targets on stage1 when
+bootstapping rustc.
+
+Upstream-Status: Backport [https://github.com/rust-lang/rust/pull/119619/commits/b888e2f82b9dbe81875f50d13adbc0271a9401ff]
+
+Signed-off-by: onur-ozkan <work@onurozkan.dev>
+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
+---
+diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
+--- a/src/bootstrap/test.rs
++++ b/src/bootstrap/test.rs
+@@ -1489,8 +1489,12 @@
+         // NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
+         // running compiler in stage 2 when plugins run.
+         let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 {
+-            compiler = builder.compiler(compiler.stage - 1, target);
+-            format!("stage{}-{}", compiler.stage + 1, target)
++            // At stage 0 (stage - 1) we are using the beta compiler. Using `self.target` can lead finding
++            // an incorrect compiler path on cross-targets, as the stage 0 beta compiler is always equal
++            // to `build.build` in the configuration.
++            let build = builder.build.build;
++            compiler = builder.compiler(compiler.stage - 1, build);
++            format!("stage{}-{}", compiler.stage + 1, build)
+         } else {
+             format!("stage{}-{}", compiler.stage, target)
+         };