* [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper [not found] <cover.1763370163.git.mchehab+huawei@kernel.org> @ 2025-11-17 9:12 ` Mauro Carvalho Chehab 2025-11-17 9:20 ` Miguel Ojeda 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2025-11-17 9:12 UTC (permalink / raw) To: Linux Doc Mailing List, Jonathan Corbet Cc: Mauro Carvalho Chehab, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux The makefile logic to detect if rust is enabled is not working the way it was expected. Move it to be inside the wrapper script. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- Documentation/Makefile | 6 ----- tools/docs/sphinx-build-wrapper | 41 +++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index d514ab6761dc..d4c42aa89439 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -42,12 +42,6 @@ FONTS_CONF_DENY_VF ?= $(HOME)/deny-vf # User-friendly check for sphinx-build HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi) -ifneq ($(wildcard $(srctree)/.config),) -ifeq ($(CONFIG_RUST),y) - RUSTDOC=--rustdoc -endif -endif - ifeq ($(HAVE_SPHINX),0) .DEFAULT: diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper index 1efaca3d16aa..a554176b5a06 100755 --- a/tools/docs/sphinx-build-wrapper +++ b/tools/docs/sphinx-build-wrapper @@ -119,6 +119,29 @@ class SphinxBuilder: return path + def check_rust(self): + """ + Checks if Rust is enabled + """ + self.rustdoc = False + + config = os.path.join(self.srctree, ".config") + + if not os.path.isfile(config): + return + + re_rust = re.compile(r"CONFIG_RUST=(m|y)") + + try: + with open(config, "r", encoding="utf-8") as fp: + for line in fp: + if re_rust.match(line): + self.rustdoc = True + return + + except OSError as e: + print(f"Failed to open {config}", file=sys.stderr) + def get_sphinx_extra_opts(self, n_jobs): """ Get the number of jobs to be used for docs build passed via command @@ -236,6 +259,8 @@ class SphinxBuilder: self.get_sphinx_extra_opts(n_jobs) + self.check_rust() + # # If venv command line argument is specified, run Sphinx from venv # @@ -306,7 +331,7 @@ class SphinxBuilder: return subprocess.call(cmd, *args, **pwargs) - def handle_html(self, css, output_dir, rustdoc): + def handle_html(self, css, output_dir): """ Extra steps for HTML and epub output. @@ -327,7 +352,8 @@ class SphinxBuilder: except (OSError, IOError) as e: print(f"Warning: Failed to copy CSS: {e}", file=sys.stderr) - if rustdoc: + if self.rustdoc: + print("Building rust docs") if "MAKE" in self.env: cmd = [self.env["MAKE"]] else: @@ -622,7 +648,7 @@ class SphinxBuilder: shutil.rmtree(self.builddir, ignore_errors=True) def build(self, target, sphinxdirs=None, - theme=None, css=None, paper=None, deny_vf=None, rustdoc=False, + theme=None, css=None, paper=None, deny_vf=None, skip_sphinx=False): """ Build documentation using Sphinx. This is the core function of this @@ -671,7 +697,7 @@ class SphinxBuilder: args.extend(["-D", f"latex_elements.papersize={paper}paper"]) - if rustdoc: + if self.rustdoc: args.extend(["-t", "rustdoc"]) if not sphinxdirs: @@ -749,7 +775,7 @@ class SphinxBuilder: # Ensure that each html/epub output will have needed static files # if target in ["htmldocs", "epubdocs"]: - self.handle_html(css, output_dir, rustdoc) + self.handle_html(css, output_dir) # # Step 2: Some targets (PDF and info) require an extra step once @@ -804,9 +830,6 @@ def main(): parser.add_argument('--deny-vf', help="Configuration to deny variable fonts on pdf builds") - parser.add_argument('--rustdoc', action="store_true", - help="Enable rustdoc build. Requires CONFIG_RUST") - parser.add_argument("-v", "--verbose", action='store_true', help="place build in verbose mode") @@ -834,7 +857,7 @@ def main(): builder.build(args.target, sphinxdirs=args.sphinxdirs, theme=args.theme, css=args.css, paper=args.paper, - rustdoc=args.rustdoc, deny_vf=args.deny_vf, + deny_vf=args.deny_vf, skip_sphinx=args.skip_sphinx_build) if __name__ == "__main__": -- 2.51.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-17 9:12 ` [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper Mauro Carvalho Chehab @ 2025-11-17 9:20 ` Miguel Ojeda 2025-11-17 11:04 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Miguel Ojeda @ 2025-11-17 9:20 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Linux Doc Mailing List, Jonathan Corbet, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux On Mon, Nov 17, 2025 at 10:13 AM Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > The makefile logic to detect if rust is enabled is not working > the way it was expected. Move it to be inside the wrapper > script. Hmm... Could the commit explain a bit why this didn't work and why now it does? Thanks! Cheers, Miguel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-17 9:20 ` Miguel Ojeda @ 2025-11-17 11:04 ` Mauro Carvalho Chehab 2025-11-18 16:38 ` Jonathan Corbet 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2025-11-17 11:04 UTC (permalink / raw) To: Miguel Ojeda Cc: Mauro Carvalho Chehab, Linux Doc Mailing List, Jonathan Corbet, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux On Mon, Nov 17, 2025 at 10:20:46AM +0100, Miguel Ojeda wrote: > On Mon, Nov 17, 2025 at 10:13 AM Mauro Carvalho Chehab > <mchehab+huawei@kernel.org> wrote: > > > > The makefile logic to detect if rust is enabled is not working > > the way it was expected. Move it to be inside the wrapper > > script. > > Hmm... Could the commit explain a bit why this didn't work and why now it does? I don't know exactly why this was not working. I guess one of the issues is that the "rustdoc" target becomes undefined if RUST is not enabled, e.g. rust/Makefile is lacking something like: ifdef CONFIG_RUST ... else rustdoc rustdoc-core rustdoc-macros rustdoc-compiler_builtins: $(warning Rust is not enabled. Can't build $<) endif But this is not enough to explain the issues I'm getting. Maybe the other issues are cache related. In any case, here, with Fedora 43, on some cases, when I run: make htmldocs # or make SPHINXDIRS=xxx htmldocs it sometimes, after building the docs, it tries to run: make LLVM=1 rustdoc as this is not a defined target when CONFIG_RUST is not present, this causes it to build the entire code. -- Thanks, Mauro ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-17 11:04 ` Mauro Carvalho Chehab @ 2025-11-18 16:38 ` Jonathan Corbet 2025-11-18 19:11 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Jonathan Corbet @ 2025-11-18 16:38 UTC (permalink / raw) To: Mauro Carvalho Chehab, Miguel Ojeda Cc: Mauro Carvalho Chehab, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes: > On Mon, Nov 17, 2025 at 10:20:46AM +0100, Miguel Ojeda wrote: >> On Mon, Nov 17, 2025 at 10:13 AM Mauro Carvalho Chehab >> <mchehab+huawei@kernel.org> wrote: >> > >> > The makefile logic to detect if rust is enabled is not working >> > the way it was expected. Move it to be inside the wrapper >> > script. >> >> Hmm... Could the commit explain a bit why this didn't work and why now it does? > > I don't know exactly why this was not working. I would feel a lot better if we knew what the real problem is before applying fixes for it. Otherwise something seems certain to come and bite us at some point. Thanks, jon ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-18 16:38 ` Jonathan Corbet @ 2025-11-18 19:11 ` Mauro Carvalho Chehab 2025-11-18 20:32 ` Mauro Carvalho Chehab 2025-11-18 21:40 ` Miguel Ojeda 0 siblings, 2 replies; 9+ messages in thread From: Mauro Carvalho Chehab @ 2025-11-18 19:11 UTC (permalink / raw) To: Jonathan Corbet Cc: Miguel Ojeda, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux Em Tue, 18 Nov 2025 09:38:15 -0700 Jonathan Corbet <corbet@lwn.net> escreveu: > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes: > > > On Mon, Nov 17, 2025 at 10:20:46AM +0100, Miguel Ojeda wrote: > >> On Mon, Nov 17, 2025 at 10:13 AM Mauro Carvalho Chehab > >> <mchehab+huawei@kernel.org> wrote: > >> > > >> > The makefile logic to detect if rust is enabled is not working > >> > the way it was expected. Move it to be inside the wrapper > >> > script. > >> > >> Hmm... Could the commit explain a bit why this didn't work and why now it does? > > > > I don't know exactly why this was not working. > > I would feel a lot better if we knew what the real problem is before > applying fixes for it. Otherwise something seems certain to come and > bite us at some point. Me too, but the bug is very annoying ;-) I'll try to seek for some time to better understand it, maybe next week. Thanks, Mauro ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-18 19:11 ` Mauro Carvalho Chehab @ 2025-11-18 20:32 ` Mauro Carvalho Chehab 2025-11-18 21:34 ` Miguel Ojeda 2025-11-18 21:40 ` Miguel Ojeda 1 sibling, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2025-11-18 20:32 UTC (permalink / raw) To: Jonathan Corbet Cc: Miguel Ojeda, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux Em Tue, 18 Nov 2025 20:11:52 +0100 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu: > Em Tue, 18 Nov 2025 09:38:15 -0700 > Jonathan Corbet <corbet@lwn.net> escreveu: > > > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes: > > > > > On Mon, Nov 17, 2025 at 10:20:46AM +0100, Miguel Ojeda wrote: > > >> On Mon, Nov 17, 2025 at 10:13 AM Mauro Carvalho Chehab > > >> <mchehab+huawei@kernel.org> wrote: > > >> > > > >> > The makefile logic to detect if rust is enabled is not working > > >> > the way it was expected. Move it to be inside the wrapper > > >> > script. > > >> > > >> Hmm... Could the commit explain a bit why this didn't work and why now it does? > > > > > > I don't know exactly why this was not working. > > > > I would feel a lot better if we knew what the real problem is before > > applying fixes for it. Otherwise something seems certain to come and > > bite us at some point. > > Me too, but the bug is very annoying ;-) > > I'll try to seek for some time to better understand it, maybe > next week. Btw, at least here (Fedora 43, upgraded from 42), rustdoc doesn't build for docs-next. Perhaps the issue could be due to some weird things with Fedora 43. That's what happens after sphinx-build-wrapper finishes handling htmldocs (after this patch), when it runs "make LLVM=1 rustdoc": Building rust docs DESCEND objtool INSTALL libsubcmd_headers CALL scripts/checksyscalls.sh RUSTC L rust/bindings.o RUSTC L rust/build_error.o RUSTC L rust/uapi.o error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `build_error` --> rust/build_error.rs:3:1 | 3 | //! Build-time error. | ^ | = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kernel-address` in dependency `core` = help: set `-Zsanitizer=kernel-address` in this crate or unset `-Zsanitizer` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `build_error` --> rust/build_error.rs:3:1 | 3 | //! Build-time error. | ^ | = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kernel-address` in dependency `compiler_builtins` = help: set `-Zsanitizer=kernel-address` in this crate or unset `-Zsanitizer` in `compiler_builtins` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error error: aborting due to 2 previous errors make[4]: *** [rust/Makefile:527: rust/build_error.o] Error 1 make[4]: ** Esperando que outros processos terminem. make[3]: *** [Makefile:1286: prepare] Error 2 Ignored errors when building rustdoc: Command '['make', 'rustdoc']' returned non-zero exit status 2.. Is RUST enabled? Relevant Rust configs: $ grep RUST .config CONFIG_RUSTC_VERSION=109100 CONFIG_RUST_IS_AVAILABLE=y CONFIG_RUSTC_LLVM_VERSION=210103 CONFIG_RUSTC_HAS_COERCE_POINTEE=y CONFIG_RUSTC_HAS_SPAN_FILE=y CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES=y CONFIG_RUSTC_HAS_FILE_WITH_NUL=y CONFIG_RUSTC_HAS_FILE_AS_C_STR=y CONFIG_RUST=y CONFIG_RUSTC_VERSION_TEXT="rustc 1.91.0 (f8297e351 2025-10-28) (Fedora 1.91.0-1.fc43)" # CONFIG_CPUFREQ_DT_RUST is not set CONFIG_HAVE_RUST=y # CONFIG_RUST_FW_LOADER_ABSTRACTIONS is not set # CONFIG_BLK_DEV_RUST_NULL is not set # CONFIG_RUST_PHYLIB_ABSTRACTIONS is not set CONFIG_RADIO_TRUST=y CONFIG_RADIO_TRUST_PORT=350 CONFIG_HID_THRUSTMASTER=y CONFIG_THRUSTMASTER_FF=y CONFIG_TRUSTED_KEYS=y CONFIG_HAVE_TRUSTED_KEYS=y CONFIG_TRUSTED_KEYS_TPM=y CONFIG_TRUSTED_KEYS_TEE=y CONFIG_TRUSTED_KEYS_CAAM=y CONFIG_INTEGRITY_TRUSTED_KEYRING=y CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y # CONFIG_RUST_BITMAP_HARDENED is not set CONFIG_SYSTEM_TRUSTED_KEYRING=y CONFIG_SYSTEM_TRUSTED_KEYS="" CONFIG_SECONDARY_TRUSTED_KEYRING=y CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN=y # CONFIG_SAMPLES_RUST is not set # CONFIG_FIND_BIT_BENCHMARK_RUST is not set # CONFIG_RUST_DEBUG_ASSERTIONS is not set CONFIG_RUST_OVERFLOW_CHECKS=y # CONFIG_RUST_BUILD_ASSERT_ALLOW is not set CONFIG_RUST_KERNEL_DOCTESTS=y Thanks, Mauro ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-18 20:32 ` Mauro Carvalho Chehab @ 2025-11-18 21:34 ` Miguel Ojeda 0 siblings, 0 replies; 9+ messages in thread From: Miguel Ojeda @ 2025-11-18 21:34 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Jonathan Corbet, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux On Tue, Nov 18, 2025 at 9:32 PM Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > Btw, at least here (Fedora 43, upgraded from 42), rustdoc doesn't build > for docs-next. > > Perhaps the issue could be due to some weird things with Fedora 43. > > That's what happens after sphinx-build-wrapper finishes handling > htmldocs (after this patch), when it runs "make LLVM=1 rustdoc": That one is fixed with commit 16c43a56b79e ("rust: kbuild: treat `build_error` and `rustdoc` as kernel objects") which is in -rc5. Cheers, Miguel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-18 19:11 ` Mauro Carvalho Chehab 2025-11-18 20:32 ` Mauro Carvalho Chehab @ 2025-11-18 21:40 ` Miguel Ojeda 2025-11-20 20:13 ` Mauro Carvalho Chehab 1 sibling, 1 reply; 9+ messages in thread From: Miguel Ojeda @ 2025-11-18 21:40 UTC (permalink / raw) To: Mauro Carvalho Chehab, Carlos Bilbao Cc: Jonathan Corbet, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux On Tue, Nov 18, 2025 at 8:12 PM Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > Me too, but the bug is very annoying ;-) > > I'll try to seek for some time to better understand it, maybe > next week. I will try to find a moment to take a look too... This happens with only the new wrapper, right? Or is it something that happened even before? If the latter, I remember testing the logic that Carlos added a long time ago, but maybe something changed in the meantime. Cheers, Miguel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper 2025-11-18 21:40 ` Miguel Ojeda @ 2025-11-20 20:13 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 9+ messages in thread From: Mauro Carvalho Chehab @ 2025-11-20 20:13 UTC (permalink / raw) To: Miguel Ojeda Cc: Carlos Bilbao, Jonathan Corbet, Linux Doc Mailing List, Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo, Mauro Carvalho Chehab, Miguel Ojeda, Trevor Gross, linux-kernel, rust-for-linux Em Tue, 18 Nov 2025 22:40:09 +0100 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> escreveu: > On Tue, Nov 18, 2025 at 8:12 PM Mauro Carvalho Chehab > <mchehab+huawei@kernel.org> wrote: > > > > Me too, but the bug is very annoying ;-) > > > > I'll try to seek for some time to better understand it, maybe > > next week. > > I will try to find a moment to take a look too... This happens with > only the new wrapper, right? Or is it something that happened even > before? If the latter, I remember testing the logic that Carlos added > a long time ago, but maybe something changed in the meantime. I'm testing here against docs/docs-next, so it is based on -rc1, so, yeah this is after the cleanups. The problem could be introduced by the Makefile cleanup, but I didn't find anything obvious but I haven't time to revisit after sending the patch, as I got sidetracked with unrelated issues (*). I'll try testing it tomorrow against linux-next. Thanks, Mauro --- (*) I was preparing a new rasdaemon release, which was launched today. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-20 20:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1763370163.git.mchehab+huawei@kernel.org>
2025-11-17 9:12 ` [PATCH 1/1] docs: makefile: move rustdoc check to the build wrapper Mauro Carvalho Chehab
2025-11-17 9:20 ` Miguel Ojeda
2025-11-17 11:04 ` Mauro Carvalho Chehab
2025-11-18 16:38 ` Jonathan Corbet
2025-11-18 19:11 ` Mauro Carvalho Chehab
2025-11-18 20:32 ` Mauro Carvalho Chehab
2025-11-18 21:34 ` Miguel Ojeda
2025-11-18 21:40 ` Miguel Ojeda
2025-11-20 20:13 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).