Skip to content

Commit 5ce86c6

Browse files
masahir0yojeda
authored andcommitted
rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
While this is a somewhat unusual case, I encountered odd error messages when I ran Kconfig in a foreign architecture chroot. $ make allmodconfig sh: 1: rustc: not found sh: 1: bindgen: not found # # configuration written to .config # The successful execution of 'command -v rustc' does not necessarily mean that 'rustc --version' will succeed. $ sh -c 'command -v rustc' /home/masahiro/.cargo/bin/rustc $ sh -c 'rustc --version' sh: 1: rustc: not found Here, 'rustc' is built for x86, and I ran it in an arm64 system. The current code: command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n can be turned into: command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version 2>/dev/null || echo n However, I did not understand the necessity of 'command -v $(RUSTC)'. I simplified it to: $(RUSTC) --version 2>/dev/null || echo n Fixes: 2f7ab12 ("Kbuild: add Rust support") Signed-off-by: Masahiro Yamada <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Rebased on top of v6.11-rc1. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8400291 commit 5ce86c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

init/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,15 +1919,15 @@ config RUST
19191919
config RUSTC_VERSION_TEXT
19201920
string
19211921
depends on RUST
1922-
default $(shell,command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n)
1922+
default $(shell,$(RUSTC) --version 2>/dev/null || echo n)
19231923

19241924
config BINDGEN_VERSION_TEXT
19251925
string
19261926
depends on RUST
19271927
# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
19281928
# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
19291929
# the minimum version is upgraded past that (0.69.1 already fixed the issue).
1930-
default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version workaround-for-0.69.0 || echo n)
1930+
default $(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null || echo n)
19311931

19321932
#
19331933
# Place an empty function call at each tracepoint site. Can be

0 commit comments

Comments
 (0)