Image

bindgen: kernel build failure due to 0.66 bug (fixed upstream)

Bug #2086641 reported by Miguel Ojeda
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
rust-bindgen-cli (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hi,

Ubuntu LTS (24.04)'s `bindgen` is not able to build a kernel with Rust enabled due to a bug (fixed upstream) in 0.66:

    $ bindgen --version --verbose
    bindgen 0.66.1
    Clang: Ubuntu clang version 18.1.3 (1ubuntu1)

    $ make LLVM=1
    ...
    ***
    *** Rust bindings generator 'bindgen' versions 0.66.0 and 0.66.1 may not
    *** work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2567),
    *** unless patched (like Debian's).
    *** Your version: 0.66.1
    ***
    ***
    *** Please see Documentation/rust/quick-start.rst for details
    *** on how to set up the Rust support.
    ***
    ...
      BINDGEN rust/bindings/bindings_generated.rs
    panicked at 'called `Result::unwrap()` on an `Err` value: FromBytesWithNulError { kind: InteriorNul(4) }', /usr/share/cargo/registry/bindgen-0.66.1/codegen/mod.rs:717:71

The message above comes from a build test we have in the kernel build system where we test if the bug is present or not:

    $ echo '#define A "\0"' >x.h && bindgen x.h
    panicked at 'called `Result::unwrap()` on an `Err` value: FromBytesWithNulError { kind: InteriorNul(0) }', /usr/share/cargo/registry/bindgen-0.66.1/codegen/mod.rs:717:71

The bug was fixed upstream with:

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

The fix was backported in Debian Testing's `bindgen` package.

It would be nice to have that fixed in Ubuntu's `bindgen` too, so that users do not need to use e.g. `bindgen-0.65`, which is the current one we recommend in our instructions:

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

Thanks!

Cheers,
Miguel

Revision history for this message Image
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rust-bindgen-cli (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.