Skip to content

Failure to compile libbpf-tools directory due to rust build error #5389

@VorpalBlade

Description

@VorpalBlade
$ git clone --recursive https://github.com/iovisor/bcc
$ cd bcc/libbpf-tools
$ make
[...]
error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1024:42
     |
1024 |                     file_name: from_cstr((*c).params.elf.file_name),
     |                                          ^^-^^^^^^^^^^^^^^^^^^^^^^
     |                                            |
     |                                            this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
     = note: `#[deny(dangerous_implicit_autorefs)]` on by default
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1024 |                     file_name: from_cstr((&(*c).params.elf).file_name),
     |                                          ++               +

error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1025:35
     |
1025 |                     base_address: (*c).params.elf.base_address,
     |                                   ^^-^^^^^^^^^^^^^^^^^^^^^^^^^
     |                                     |
     |                                     this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1025 |                     base_address: (&(*c).params.elf).base_address,
     |                                   ++               +

error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1029:32
     |
1029 |                 let kallsyms = (*c).params.kernel.kallsyms;
     |                                ^^-^^^^^^^^^^^^^^^^^^^^^^^^
     |                                  |
     |                                  this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1029 |                 let kallsyms = (&(*c).params.kernel).kallsyms;
     |                                ++                  +

error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1030:36
     |
1030 |                 let kernel_image = (*c).params.kernel.kernel_image;
     |                                    ^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |                                      |
     |                                      this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1030 |                 let kernel_image = (&(*c).params.kernel).kernel_image;
     |                                    ++                  +

error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1046:29
     |
1046 |                     pid: if (*c).params.process.pid > 0 {
     |                             ^^-^^^^^^^^^^^^^^^^^^^^
     |                               |
     |                               this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1046 |                     pid: if (&(*c).params.process).pid > 0 {
     |                             ++                   +

error: implicit autoref creates a reference to the dereference of a raw pointer
    --> src/lib.rs:1047:30
     |
1047 |                         Some((*c).params.process.pid)
     |                              ^^-^^^^^^^^^^^^^^^^^^^^
     |                                |
     |                                this raw pointer has type `*const sym_src_cfg`
     |
     = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
     = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
     |
1047 |                         Some((&(*c).params.process).pid)
     |                              ++                   +

warning: unused return value of `Box::<T>::from_raw` that must be used
    --> src/lib.rs:1089:9
     |
1089 |         Box::from_raw((*symbolizer).symbolizer);
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
help: use `let _ = ...` to ignore the resulting value
     |
1089 |         let _ = Box::from_raw((*symbolizer).symbolizer);
     |         +++++++

warning: unused return value of `Box::<T>::from_raw` that must be used
    --> src/lib.rs:1090:9
     |
1090 |         Box::from_raw(symbolizer);
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
help: use `let _ = ...` to ignore the resulting value
     |
1090 |         let _ = Box::from_raw(symbolizer);
     |         +++++++

warning: `blazesym` (lib) generated 8 warnings
error: could not compile `blazesym` (lib) due to 6 previous errors; 8 warnings emitted

It looks like the blazesym submodule is 3 years out of date, and just updating to the latest is not enough, but needs a bit of work.

Versions:

rustc --version --verbose
rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-unknown-linux-gnu
release: 1.89.0
LLVM version: 20.1.7
  • Arch Linux (rolling release distro)
  • Linux 6.15.7 (x86_64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions