summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust
diff options
context:
space:
mode:
authorYash Shinde <Yash.Shinde@windriver.com>2024-01-25 05:15:57 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-26 14:06:55 +0000
commit357651377f79bf5c75a37a578d4aa23327477ffe (patch)
tree53f4d4bc49269dd8f5b216d346a59e5d424b1f85 /meta/recipes-devtools/rust
parent7f9dd77eaeaf586c88ee1b5f4f5ee0439612b964 (diff)
downloadpoky-357651377f79bf5c75a37a578d4aa23327477ffe.tar.gz
rust: Fetch cargo from rust-snapshot dir.
Fixes: Exception: no cargo executable found at `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo` Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir. Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125 (From OE-Core rev: 1a048b5ab7f891911beaa14eb9269033c84088dc) Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust')
-rw-r--r--meta/recipes-devtools/rust/files/cargo-path.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/files/cargo-path.patch b/meta/recipes-devtools/rust/files/cargo-path.patch
new file mode 100644
index 0000000000..84bd580aa7
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/cargo-path.patch
@@ -0,0 +1,37 @@
1Fix the cargo binary path error and ensure that it is fetched
2during rustc bootstrap in rust oe-selftest.
3
4======================================================================
5ERROR: test_cargoflags (bootstrap_test.BuildBootstrap)
6----------------------------------------------------------------------
7Traceback (most recent call last):
8 File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 157, in test_cargoflags
9 args, _ = self.build_args(env={"CARGOFLAGS": "--timings"})
10 File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 154, in build_args
11 return build.build_bootstrap_cmd(env), env
12 File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap.py", line 960, in build_bootstrap_cmd
13 raise Exception("no cargo executable found at `{}`".format(
14Exception: no cargo executable found at `/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`
15
16Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/120125]
17
18Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
19---
20diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
21--- a/src/bootstrap/bootstrap.py
22+++ b/src/bootstrap/bootstrap.py
23@@ -954,9 +954,11 @@
24 if deny_warnings:
25 env["RUSTFLAGS"] += " -Dwarnings"
26
27- env["PATH"] = os.path.join(self.bin_root(), "bin") + \
28- os.pathsep + env["PATH"]
29- if not os.path.isfile(self.cargo()):
30+ cargo_bin_path = os.path.join(self.bin_root(), "bin", "cargo")
31+ if not os.path.isfile(cargo_bin_path):
32+ cargo_bin_path = os.getenv("RUST_TARGET_PATH") + "rust-snapshot/bin/cargo"
33+ env["PATH"] = os.path.dirname(cargo_bin_path) + os.pathsep + env["PATH"]
34+ else:
35 raise Exception("no cargo executable found at `{}`".format(
36 self.cargo()))
37 args = [self.cargo(), "build", "--manifest-path",