| Message ID | 20260109045447.1933604-1-alistair.francis@wdc.com |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | [1/2] rust: Install the Rust source | expand |
On Fri Jan 9, 2026 at 5:54 AM CET, Alistair Francis via lists.openembedded.org wrote: > From: Alistair Francis <alistair.francis@wdc.com> > > When building the Linux kernel with Rust support enabled the kernel > expects to find the Rust source as the kernel build system will cross > compile the core library. > > This patch uses the Rust tooling to install the Rust source when we > install the compiller as well. > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > --- Hi Alistair, Thanks for your patch. It looks like the cargo patch does not apply correctly. Is this working on your side on the master branch? ERROR: cargo-native-1.92.0-r0 do_patch: Applying patch '/srv/pokybuild/yocto-worker/genericx86-64/build/layers/openembedded-core/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch' on target directory '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-linux/cargo-native/1.92.0/sources/rustc-1.92.0-src/src/tools/cargo' ... CmdError('quilt --quiltrc /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-linux/cargo-native/1.92.0/recipe-sysroot-native/etc/quiltrc push', 0, "stdout: Applying patch 0001-bootstrap-Ensure-host-documentation-is-built-before-.patch can't find file to patch at input line 33 Perhaps you used the wrong -p or --strip option? https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/3012 https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/2980 ... Can you have a look at this issue? Thanks, Mathieu
Le ven. 9 janv. 2026 à 05:55, Alistair Francis via lists.openembedded.org <alistair23=gmail.com@lists.openembedded.org> a écrit : > From: Alistair Francis <alistair.francis@wdc.com> > > When building the Linux kernel with Rust support enabled the kernel > expects to find the Rust source as the kernel build system will cross > compile the core library. > > This patch uses the Rust tooling to install the Rust source when we > install the compiller as well. > Hello, FYI, there is currently a whole series about enabling rust in the linux-yocto kernel : https://lore.kernel.org/openembedded-core/20251230141540.1974380-1-Harish.Sadineni@windriver.com/ How does your series interact with it? If both do the same thing, maybe you can help reviewing Harish's one? Also, the patch you add only mentions adding the *doc* why does that help with linux-yocto searching for rust *code*? Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > --- > ...-host-documentation-is-built-before-.patch | 60 +++++++++++++++++++ > meta/recipes-devtools/rust/rust-source.inc | 1 + > meta/recipes-devtools/rust/rust_1.92.0.bb | 4 +- > 3 files changed, 64 insertions(+), 1 deletion(-) > create mode 100644 > meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch > > diff --git > a/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch > b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch > new file mode 100644 > index 0000000000..e561266d70 > --- /dev/null > +++ > b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch > @@ -0,0 +1,60 @@ > +From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00 2001 > +From: Alistair Francis <alistair.francis@wdc.com> > +Date: Fri, 9 Jan 2026 08:35:43 +1000 > +Subject: [PATCH] bootstrap: Ensure host documentation is built before > tarball > + is created > + > +`run_default_doc_steps()` is called to ensure the documentation is built > +by `Docs::run()` and it should build the documentation if it isn't > +already built. > + > +When running the `install src` command I'm seeing failures as the > +`builder.doc_out(host)` directory does not exist. This is because > +`match_paths_to_steps_and_run()` doesn't actually build any > +documentation as the `paths.is_empty()` causes an early return. This > +results in install failures as the `*/doc` src directory doesn't exist. > + > +This patch passes the paths to `run_host_step_descriptions()` when > building > +documentation to ensure it is correctly built. > + > +This fixes installing the Rust source code in OpenEmbedded. > + > +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/150845 > ] > +Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > +--- > + src/bootstrap/src/core/build_steps/dist.rs | 2 +- > + src/bootstrap/src/core/builder/mod.rs | 5 +++++ > + 2 files changed, 6 insertions(+), 1 deletion(-) > + > +diff --git a/src/bootstrap/src/core/build_steps/dist.rs > b/src/bootstrap/src/core/build_steps/dist.rs > +index f47b0c0b007..2fbb068632e 100644 > +--- a/src/bootstrap/src/core/build_steps/dist.rs > ++++ b/src/bootstrap/src/core/build_steps/dist.rs > +@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) -> > Option<GeneratedTarball> { > + // FIXME: explicitly enumerate the steps that should be executed > here, and gather their > + // documentation, rather than running all default steps and then > read their output > + // from a shared directory. > +- builder.run_default_doc_steps(); > ++ builder.run_host_default_doc_steps(); > + > + let dest = "share/doc/rust/html"; > + > +diff --git a/src/bootstrap/src/core/builder/mod.rs > b/src/bootstrap/src/core/builder/mod.rs > +index 4a04b97c549..16c1c324be0 100644 > +--- a/src/bootstrap/src/core/builder/mod.rs > ++++ b/src/bootstrap/src/core/builder/mod.rs > +@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) { > + > self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), > &self.paths); > + } > + > ++ /// Run all default documentation steps to build documentation. > ++ pub fn run_host_default_doc_steps(&self) { > ++ > self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), > &self.paths); > ++ } > ++ > + /// Run all default documentation steps to build documentation. > + pub fn run_default_doc_steps(&self) { > + > self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), > &[]); > +-- > +2.52.0 > + > diff --git a/meta/recipes-devtools/rust/rust-source.inc > b/meta/recipes-devtools/rust/rust-source.inc > index d7d44510e4..8a22d484c1 100644 > --- a/meta/recipes-devtools/rust/rust-source.inc > +++ b/meta/recipes-devtools/rust/rust-source.inc > @@ -8,6 +8,7 @@ SRC_URI += " > https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n > > 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://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} > \ > + > file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch \ > " > SRC_URI[rust.sha256sum] = > "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307" > > diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb > b/meta/recipes-devtools/rust/rust_1.92.0.bb > index a25f65f674..306661b6e4 100644 > --- a/meta/recipes-devtools/rust/rust_1.92.0.bb > +++ b/meta/recipes-devtools/rust/rust_1.92.0.bb > @@ -6,8 +6,9 @@ LIC_FILES_CHKSUM = > "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc" > > inherit rust > inherit cargo_common > +inherit pkgconfig > > -DEPENDS += "llvm" > +DEPENDS += "llvm openssl" > This new dependency should be explained in the commit message. > # native rust uses cargo/rustc from binary snapshots to bootstrap > # but everything else should use our native builds > DEPENDS:append:class-target = " cargo-native rust-native" > @@ -282,6 +283,7 @@ do_install () { > > rust_do_install() { > rust_runx install > + rust_runx install src > } > > rust_do_install:class-nativesdk() { > -- > 2.52.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#229091): > https://lists.openembedded.org/g/openembedded-core/message/229091 > Mute This Topic: https://lists.openembedded.org/mt/117170671/4316185 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > yoann.congal@smile.fr] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch new file mode 100644 index 0000000000..e561266d70 --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch @@ -0,0 +1,60 @@ +From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00 2001 +From: Alistair Francis <alistair.francis@wdc.com> +Date: Fri, 9 Jan 2026 08:35:43 +1000 +Subject: [PATCH] bootstrap: Ensure host documentation is built before tarball + is created + +`run_default_doc_steps()` is called to ensure the documentation is built +by `Docs::run()` and it should build the documentation if it isn't +already built. + +When running the `install src` command I'm seeing failures as the +`builder.doc_out(host)` directory does not exist. This is because +`match_paths_to_steps_and_run()` doesn't actually build any +documentation as the `paths.is_empty()` causes an early return. This +results in install failures as the `*/doc` src directory doesn't exist. + +This patch passes the paths to `run_host_step_descriptions()` when building +documentation to ensure it is correctly built. + +This fixes installing the Rust source code in OpenEmbedded. + +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/150845] +Signed-off-by: Alistair Francis <alistair.francis@wdc.com> +--- + src/bootstrap/src/core/build_steps/dist.rs | 2 +- + src/bootstrap/src/core/builder/mod.rs | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs +index f47b0c0b007..2fbb068632e 100644 +--- a/src/bootstrap/src/core/build_steps/dist.rs ++++ b/src/bootstrap/src/core/build_steps/dist.rs +@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { + // FIXME: explicitly enumerate the steps that should be executed here, and gather their + // documentation, rather than running all default steps and then read their output + // from a shared directory. +- builder.run_default_doc_steps(); ++ builder.run_host_default_doc_steps(); + + let dest = "share/doc/rust/html"; + +diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs +index 4a04b97c549..16c1c324be0 100644 +--- a/src/bootstrap/src/core/builder/mod.rs ++++ b/src/bootstrap/src/core/builder/mod.rs +@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) { + self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths); + } + ++ /// Run all default documentation steps to build documentation. ++ pub fn run_host_default_doc_steps(&self) { ++ self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &self.paths); ++ } ++ + /// Run all default documentation steps to build documentation. + pub fn run_default_doc_steps(&self) { + self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &[]); +-- +2.52.0 + diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index d7d44510e4..8a22d484c1 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -8,6 +8,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n 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://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} \ + file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch \ " SRC_URI[rust.sha256sum] = "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307" diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb b/meta/recipes-devtools/rust/rust_1.92.0.bb index a25f65f674..306661b6e4 100644 --- a/meta/recipes-devtools/rust/rust_1.92.0.bb +++ b/meta/recipes-devtools/rust/rust_1.92.0.bb @@ -6,8 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc" inherit rust inherit cargo_common +inherit pkgconfig -DEPENDS += "llvm" +DEPENDS += "llvm openssl" # native rust uses cargo/rustc from binary snapshots to bootstrap # but everything else should use our native builds DEPENDS:append:class-target = " cargo-native rust-native" @@ -282,6 +283,7 @@ do_install () { rust_do_install() { rust_runx install + rust_runx install src } rust_do_install:class-nativesdk() {