Public bug reported:

Hi,

Current Ubuntu non-LTS (oracular)'s `bindgen` will run into a kernel
build failure in the future (in a couple weeks, when the new tracepoints
support gets merged):

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

    $ 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. The
latest Ubuntu LTS is OK (in regards to this bug, using `bindgen-0.65`
rather than `bindgen`) thanks to the older `libclang`.

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.

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

Debian Sid also suffered from the same issue, please see the details at:

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086510

In particular, using Debian's package, 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.

The consequence of not doing anything would be that kernel developers
using Ubuntu 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 Ubuntu at:

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

Thanks!

(I reported this via email to the maintainers first a few days ago)

Cheers,
Miguel

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


** Tags: fixed-upstream patch

** Description changed:

  Hi,
  
  Current Ubuntu non-LTS (oracular)'s `bindgen` will run into a kernel
  build failure in the future (in a couple weeks, when the new tracepoints
  support gets merged):
  
-     $ bindgen --version --verbose
-     bindgen 0.66.1
-     Clang: Ubuntu clang version 19.1.1 (1ubuntu1)
+     $ bindgen --version --verbose
+     bindgen 0.66.1
+     Clang: Ubuntu clang version 19.1.1 (1ubuntu1)
  
-     $ 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
-     ...
+     $ 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. The
  latest Ubuntu LTS is OK (in regards to this bug, using `bindgen-0.65`
  rather than `bindgen`) thanks to the older `libclang`.
  
  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
+     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")
+     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.
  
  Upgrading to `bindgen 0.70.x` should also fix the issue.
  
  Debian Sid also suffered from the same issue, please see the details at:
  
-     https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086510
+     https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086510
  
  In particular, using Debian's package, 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.
  
  The consequence of not doing anything would be that kernel developers
  using Ubuntu 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 Ubuntu at:
  
-     https://docs.kernel.org/next/rust/quick-start.html#ubuntu
+     https://docs.kernel.org/next/rust/quick-start.html#ubuntu
  
  Thanks!
  
- (I reported this via email to the maintainers first a few days ago, but
- I did')
+ (I reported this via email to the maintainers first a few days ago)
  
  Cheers,
  Miguel

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

Title:
  bindgen: bug triggers future kernel build error (fixed upstream)

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


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

Reply via email to