[Pkg-rust-maintainers] Bug#1086510: bindgen: bug triggers future kernel build error (fixed upstream)

Miguel Ojeda ojeda at kernel.org
Thu Oct 31 14:56:58 GMT 2024


Package: bindgen
X-Debbugs-Cc: ojeda at kernel.org, werdahias at riseup.net, noisycoil at disroot.org
Version: 0.66.1-7+b2
Severity: important
Tags: patch, fixed-upstream

Hi,

Current Sid's `bindgen` will run into a kernel build failure in the
future (in a few weeks, when the new tracepoints support gets merged):

    $ bindgen --version --verbose
    bindgen 0.66.1
    Clang: Debian clang version 19.1.2 (2)

    $ make LLVM=1 samples/rust/rust_print.o
    ...
    error[E0425]: cannot find value `__tracepoint_rust_sample_loaded` in crate `$crate::bindings`
      --> samples/rust/rust_print.rs:87:5
    ...

The issue triggers with `bindgen` < 0.69.5 && `libclang` >= 19.1. Debian
Testing is fine (at least the `debian:testing` image), since `libclang`
is older there.

Upstream has a fix (released for 0.70.0 and backported to 0.69.5) at:

    https://github.com/rust-lang/rust-bindgen/pull/2824

    600f63895f73 ("Use clang_getFileLocation instead of clang_getSpellingLocation")
    35f0f9aafc9b ("Use clang_getFileLocation instead of clang_getSpellingLocation")

It is a single line change which can be cleanly cherry-picked into
`bindgen` 0.66.1.

I confirmed the change would fix the issue (using `debian:sid` image): I
downloaded the Sid package sources (rust-bindgen and rust-bindgen-cli),
built the kernel to confirm the issue is there, then applied the single
line change to the sources, built the kernel again successfully.

Upgrading to `bindgen 0.70.x` should also fix the issue.

The consequence of not doing anything would be that kernel developers
using Debian would need to install a custom/newer `bindgen`, possibly
via `cargo`, instead of using their distribution package, which would be
inconvenient for them -- we are trying to keep the kernel buildable with
distributions' toolchains, e.g. see our instructions for Debian at:

    https://docs.kernel.org/rust/quick-start.html#debian

Backport PR by NoisyCoil at:

    https://salsa.debian.org/rust-team/debcargo-conf/-/merge_requests/771

Thanks!

Cheers,
Miguel



More information about the Pkg-rust-maintainers mailing list