Skip to content

rust compiler not found #934

Closed
Closed

Description

@fvalenduc

When I run make rustavailable, I get this error:


*** Rust compiler 'rustc' is too new. This may or may not work.
*** Your version: 1.65.0
*** Expected version: 1.62.0



*** Rust bindings generator 'bindgen' is too new. This may or may not work.
*** Your version: 0.59.1
*** Expected version: 0.56.0


./scripts/rust_is_available.sh: line 21: 100000 * + 100 * + : syntax error: operand expected (error token is "+ ")
make: *** [Makefile:1800: rustavailable] Error 1
zsh: exit 2 LANG=C LC_ALL=C make rustavailable

Does anybody understand what is happening ?

Activity

  1. added
    • kbuildRelated to building the kernel, `make`, `Kbuild`, `Kconfig` options...
    on Dec 5, 2022
  2. ojeda commented on Dec 5, 2022

    @ojeda
    Member

    Given the other messages appear to be correct, I am guessing there is a problem with the value of bindgen_libclang_version.

    Could you please show what the following returns?

    LC_ALL=C bindgen scripts/rust_is_available_bindgen_libclang.h

    Thanks for reporting this!

  3. fvalenduc commented on Dec 5, 2022

    @fvalenduc
    Author

    Thanks for your reply. LC_ALL=C bindgen scripts/rust_is_available_bindgen_libclang.h returns this:

    thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-.so', 'libclang.so.', 'libclang-.so.'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (invalid: [])"', src/lib.rs:2117:31
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

    If I set LIBCLANG_PATH to /usr/lib/llvm/15/lib64 in the environment variables, then it works correctly;

    22:12 francois@pc-francois /usr/src/linux-6.1% LIBCLANG_PATH=/usr/lib/llvm/15/lib64 LC_ALL=C bindgen scripts/rust_is_available_bindgen_libclang.h
    22:13 francois@pc-francois /usr/src/linux-6.1% make rustavailable


    *** Rust compiler 'rustc' is too new. This may or may not work.
    *** Your version: 1.65.0
    *** Expected version: 1.62.0



    *** Rust bindings generator 'bindgen' is too new. This may or may not work.
    *** Your version: 0.59.1
    *** Expected version: 0.56.0


    Rust is available!

    Previously, this was not needed.

  4. changed the title [-]rust compiler not founf[/-] [+]rust compiler not found[/+] on Dec 5, 2022
  5. ojeda commented on Dec 5, 2022

    @ojeda
    Member

    Sorry about that -- the error comes from bindgen itself and then the script gets confused.

    I think we could improve things on our side by catching any such error/panic and, in that case, print a proper message, possibly pointing the user to the docs at https://github.com/rust-lang/rust-bindgen#environment-variables and https://github.com/KyleMayes/clang-sys#environment-variables

    As for why it changed for you, did something change on your setup/environment? Perhaps try to use the expected versions to confirm it isn't related to that. @pvdrz may also know if something changed recently in bindgen.

  6. pvdrz commented on Dec 6, 2022

    @pvdrz

    @ojeda I don't remember any particular change but I'll try to bisect this and figure out what happened.

  7. pvdrz commented on Dec 6, 2022

    @pvdrz

    I'm not being able to reproduce this with the same bindgen and rustc versions. However I have clang 14 instead, so I suspect clang 15 is the real culprit.

    The error message you're seeing comes from the clang-sys crate which added clang 15 support in 1.4.0 and the latest bindgen release uses clang-sys 1.3.3

    We can bump the clang-sys version and do a new bindgen release but then you'd have to update your bindgen version to that.

  8. ojeda commented on Dec 6, 2022

    @ojeda
    Member

    Thanks a lot -- I have linked it from our bindgen list (even if it may or may not be related).

  9. ojeda commented on Jan 9, 2023

    @ojeda
    Member

    I think we could improve things on our side by catching any such error/panic and, in that case, print a proper message, possibly pointing the user to the docs at https://github.com/rust-lang/rust-bindgen#environment-variables and https://github.com/KyleMayes/clang-sys#environment-variables

    Submitted better error handling/docs for this in this series: https://lore.kernel.org/rust-for-linux/20230109204520.539080-1-ojeda@kernel.org/

  10. ojeda commented on Jan 10, 2023

    @ojeda
    Member

    @fvalenduc In the patch above I used your GitHub handle for the Reported-by tag, but it would be nice to have at least your email, and ideally your real name too. I will Cc you on the patch there if you provide it to me.

  11. fvalenduc commented on Jan 11, 2023

    @fvalenduc
    Author
  12. ojeda commented on Jan 11, 2023

    @ojeda
    Member

    No worries! Thanks for the reply -- the email address appears to be redacted, could you please try to separate the @ symbol or similar? Or maybe just send me a quick email to ojeda@kernel.org with it.

  13. 8 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    • kbuildRelated to building the kernel, `make`, `Kbuild`, `Kconfig` options...

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions