Re: [PATCH v2 1/1] scripts/rust_is_available: Fix clang version check

Miguel Ojeda
2023-06-16T00:31:01Z

On Sun, May 28, 2023 at 3:21 PM Ethan D. Twardy <ethan.twardy@gmail.com> wrote:
>
> 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@gmail.com>

Thanks a lot for this patch! This was previously reported and should
be fixed in this patch series (I added you as a reporter in v2):

https://lore.kernel.org/rust-for-linux/20230616001631.463536-1-ojeda@kernel.org/

If you could please test the series, to make sure it solves your
issue, it would be great!

Cheers,
Miguel