Public bug reported:

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

** Affects: rust-bindgen-cli (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: fixed-upstream patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2086641

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-bindgen-cli/+bug/2086641/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to