summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex@linutronix.de>2024-05-16 13:21:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-22 10:21:26 +0100
commit8240d506fc107d9adf930549603466d9ced0e72b (patch)
treeb09ed2f07482b277af2f56d1e2bb5d2f2e1f4063
parent95e812313fdbac17cf60f1a6467b4f1b34fb687d (diff)
downloadpoky-8240d506fc107d9adf930549603466d9ced0e72b.tar.gz
rust: correctly link rust-snapshot into build/stage0
This does not seem to be used in regular builds, but is beneficial in rust selftest, where it allows dropping a custom patch that is unsuitable for upstream (and was rejected by them). Also remove an obsolete comment that seems related to the code but describes something that was resolved long time ago. I have confirmed that the rust selftest continues to pass with just this one commit on top of master (as the following changes do break the selftest). (From OE-Core rev: bf5732e2b235ce06fa1f24fe8f0dbcbc068500e3) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/rust/files/cargo-path.patch37
-rw-r--r--meta/recipes-devtools/rust/rust-source.inc1
-rw-r--r--meta/recipes-devtools/rust/rust_1.75.0.bb6
3 files changed, 2 insertions, 42 deletions
diff --git a/meta/recipes-devtools/rust/files/cargo-path.patch b/meta/recipes-devtools/rust/files/cargo-path.patch
deleted file mode 100644
index 9a50c40220..0000000000
--- a/meta/recipes-devtools/rust/files/cargo-path.patch
+++ /dev/null
@@ -1,37 +0,0 @@
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 "RUSTFLAGS_BOOTSTRAP" in env:
25 env["RUSTFLAGS"] += " " + env["RUSTFLAGS_BOOTSTRAP"]
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",
diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc
index b14221b6cb..c83c8ec3a3 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -7,7 +7,6 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
7 file://rv32-missing-syscalls.patch;patchdir=${RUSTSRC} \ 7 file://rv32-missing-syscalls.patch;patchdir=${RUSTSRC} \
8 file://rv32-rustix-libc-backend.patch;patchdir=${RUSTSRC} \ 8 file://rv32-rustix-libc-backend.patch;patchdir=${RUSTSRC} \
9 file://rv32-cargo-rustix-0.38.19-fix.patch;patchdir=${RUSTSRC} \ 9 file://rv32-cargo-rustix-0.38.19-fix.patch;patchdir=${RUSTSRC} \
10 file://cargo-path.patch;patchdir=${RUSTSRC} \
11 file://custom-target-cfg.patch;patchdir=${RUSTSRC} \ 10 file://custom-target-cfg.patch;patchdir=${RUSTSRC} \
12 file://rustc-bootstrap.patch;patchdir=${RUSTSRC} \ 11 file://rustc-bootstrap.patch;patchdir=${RUSTSRC} \
13 file://target-build-value.patch;patchdir=${RUSTSRC} \ 12 file://target-build-value.patch;patchdir=${RUSTSRC} \
diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb
index 662117c92c..c1b0a35e7b 100644
--- a/meta/recipes-devtools/rust/rust_1.75.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.75.0.bb
@@ -35,8 +35,6 @@ RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-co
35# own vendoring. 35# own vendoring.
36CARGO_DISABLE_BITBAKE_VENDORING = "1" 36CARGO_DISABLE_BITBAKE_VENDORING = "1"
37 37
38# We can't use RUST_BUILD_SYS here because that may be "musl" if
39# TCLIBC="musl". Snapshots are always -unknown-linux-gnu
40setup_cargo_environment () { 38setup_cargo_environment () {
41 # The first step is to build bootstrap and some early stage tools, 39 # The first step is to build bootstrap and some early stage tools,
42 # these are build for the same target as the snapshot, e.g. 40 # these are build for the same target as the snapshot, e.g.
@@ -54,8 +52,8 @@ do_rust_setup_snapshot () {
54 52
55 # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo 53 # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo
56 # and fail without it there. 54 # and fail without it there.
57 mkdir -p ${RUSTSRC}/build/${BUILD_SYS} 55 mkdir -p ${RUSTSRC}/build/${RUST_BUILD_SYS}
58 ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 56 ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${RUST_BUILD_SYS}/stage0
59 57
60 # Need to use uninative's loader if enabled/present since the library paths 58 # Need to use uninative's loader if enabled/present since the library paths
61 # are used internally by rust and result in symbol mismatches if we don't 59 # are used internally by rust and result in symbol mismatches if we don't