diff options
author | Alexander Kanavin <alex@linutronix.de> | 2024-05-16 13:21:08 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-01-26 14:04:46 -0800 |
commit | dd941e5746af70d71a5c0ebef49c1f4108168964 (patch) | |
tree | 6c6413b01fa5655796ed384e689766f44cf279b7 | |
parent | 04976a1e40e16105847d44f55747afe11dfb5374 (diff) | |
download | poky-dd941e5746af70d71a5c0ebef49c1f4108168964.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: 9b23f995fbc1886c36f02b0c6e1ccaf2ee0f6daa)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit bf5732e2b235ce06fa1f24fe8f0dbcbc068500e3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/recipes-devtools/rust/files/cargo-path.patch | 37 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust-source.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust_1.75.0.bb | 6 |
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 @@ | |||
1 | Fix the cargo binary path error and ensure that it is fetched | ||
2 | during rustc bootstrap in rust oe-selftest. | ||
3 | |||
4 | ====================================================================== | ||
5 | ERROR: test_cargoflags (bootstrap_test.BuildBootstrap) | ||
6 | ---------------------------------------------------------------------- | ||
7 | Traceback (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( | ||
14 | Exception: 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 | |||
16 | Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/120125] | ||
17 | |||
18 | Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com> | ||
19 | --- | ||
20 | diff --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 55ea1b77e6..5b433ceae7 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 f3140252a5..b041a5f8e4 100644 --- a/meta/recipes-devtools/rust/rust_1.75.0.bb +++ b/meta/recipes-devtools/rust/rust_1.75.0.bb | |||
@@ -40,8 +40,6 @@ RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-co | |||
40 | # own vendoring. | 40 | # own vendoring. |
41 | CARGO_DISABLE_BITBAKE_VENDORING = "1" | 41 | CARGO_DISABLE_BITBAKE_VENDORING = "1" |
42 | 42 | ||
43 | # We can't use RUST_BUILD_SYS here because that may be "musl" if | ||
44 | # TCLIBC="musl". Snapshots are always -unknown-linux-gnu | ||
45 | setup_cargo_environment () { | 43 | setup_cargo_environment () { |
46 | # The first step is to build bootstrap and some early stage tools, | 44 | # The first step is to build bootstrap and some early stage tools, |
47 | # these are build for the same target as the snapshot, e.g. | 45 | # these are build for the same target as the snapshot, e.g. |
@@ -59,8 +57,8 @@ do_rust_setup_snapshot () { | |||
59 | 57 | ||
60 | # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo | 58 | # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo |
61 | # and fail without it there. | 59 | # and fail without it there. |
62 | mkdir -p ${RUSTSRC}/build/${BUILD_SYS} | 60 | mkdir -p ${RUSTSRC}/build/${RUST_BUILD_SYS} |
63 | ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 | 61 | ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${RUST_BUILD_SYS}/stage0 |
64 | 62 | ||
65 | # Need to use uninative's loader if enabled/present since the library paths | 63 | # Need to use uninative's loader if enabled/present since the library paths |
66 | # are used internally by rust and result in symbol mismatches if we don't | 64 | # are used internally by rust and result in symbol mismatches if we don't |