[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230528131802.6390-2-ethan.twardy@gmail.com>
Date: Sun, 28 May 2023 08:18:02 -0500
From: "Ethan D. Twardy" <ethan.twardy@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, Tiago Lam <tiagolam@...il.com>,
Kees Cook <keescook@...omium.org>, Finn Behrens <me@...enk.de>,
rust-for-linux@...r.kernel.org (open list:RUST),
linux-kernel@...r.kernel.org (open list),
llvm@...ts.linux.dev (open list:CLANG/LLVM BUILD SUPPORT)
Cc: "Ethan D. Twardy" <ethan.twardy@...il.com>
Subject: [PATCH v2 1/1] scripts/rust_is_available: Fix clang version check
During out-of-tree builds where the path to the kernel source tree
contains a version string, scripts/rust_is_available.sh incorrectly
identified the version string of libclang to be the version string in
the kernel sources path, resulting in CONFIG_RUST_IS_AVAILABLE
erroneously set to 'n'.
This issue was previously affecting builds on distributions, such as
Gentoo Linux, where the kernel source tree is under version control,
and placed under a path containing the current kernel version string
in /usr/src.
The fix is to take special care to match only the version string
following the string 'clang version' in the output.
To reproduce:
$ cd ~/build && make -C ~/linux-6.2.0 O=$PWD LLVM=1 rustavailable
[...]
*** libclang (used by the Rust bindings generator 'bindgen') is too old.
*** Your version: 6.2.0
*** Minimum version: 11.0.0
[...]
Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`")
Signed-off-by: Ethan D. Twardy <ethan.twardy@...il.com>
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh
index aebbf1913970..e8a1439be9f8 100755
--- a/scripts/rust_is_available.sh
+++ b/scripts/rust_is_available.sh
@@ -102,8 +102,8 @@ fi
# Check that the `libclang` used by the Rust bindings generator is suitable.
bindgen_libclang_version=$( \
LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null \
- | grep -F 'clang version ' \
- | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
+ | grep -oE 'clang version [0-9]+\.[0-9]+\.[0-9]+' \
+ | cut -d' ' -f3 \
| head -n 1 \
)
bindgen_libclang_min_version=$($min_tool_version llvm)
--
2.40.1
Powered by blists - more mailing lists