Re: [PATCH v9 20/27] scripts: add `rust_is_available.sh`
From: Miguel Ojeda
Date: Tue Aug 23 2022 - 10:50:17 EST
On Mon, Aug 22, 2022 at 10:09 PM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> because I'm using clang built from source from ToT. Is this supposed
> to mean that I can't use clang-16, clang-14, clang-13, clang-12, or
> clang-11 (in the kernel we support clang-11+) in order to use rust?
> I'm guessing that's going to hinder adoption. Is there a way to
No, it is only a warning, so you can proceed if you want to risk it.
However, is there a reason you would like to mix the versions?
If not, please point `bindgen` to your newer libclang (see below).
> specify which libclang version bindgen should be using?
Yes, see below.
> I have libclang built in my clang sources,
> llvm-project/llvm/build/lib/libclang.so. I also tried:
>
> $ CLANG_PATH=/android0/llvm-project/llvm/build/lib/libclang.so.15 make
> LLVM=1 -j72 rustavailable
`CLANG_PATH` is for pointing to a `clang` executable, not `libclang`.
Instead, please try `LIBCLANG_PATH` (note the `LIB` there).
For instance, using the test header to print the libclang version,
this works for me:
$ bindgen scripts/rust_is_available_bindgen_libclang.h
... clang version 14.0.6 (https://github.com/llvm/llvm-project.git ...
$ LIBCLANG_PATH=.../libclang-6.0.so.1 \
bindgen scripts/rust_is_available_bindgen_libclang.h
... clang version 6.0.0 (tags/RELEASE_600/final) ...
If the above does not work, for details on how the dependency is
resolved, please see:
https://github.com/KyleMayes/clang-sys#linking
https://github.com/KyleMayes/clang-sys#dependencies
https://github.com/KyleMayes/clang-sys#environment-variables
https://github.com/rust-lang/rust-bindgen#environment-variables
I will add a note about this to the docs.
Cheers,
Miguel