Skip to content

Add libbpf 1.5.0 and pahole 1.30 #3227

Merged
merged 5 commits into from
Apr 14, 2025
Merged

Conversation

pmenzel
Copy link
Collaborator

@pmenzel pmenzel commented Apr 14, 2025

pahole is needed to build the BTF debug info for the Linux kernel.

[Description](https://libbpf.readthedocs.io/en/latest/libbpf_overview.html):

> libbpf is a C-based library containing a BPF loader that takes
> compiled BPF object files and prepares and loads them into the Linux
> kernel. libbpf takes the heavy lifting of loading, verifying, and
> attaching BPF programs to various kernel hooks, allowing BPF application
> developers to focus only on BPF program correctness and performance.
pahole is needed to build the BTF debug info for the Linux kernel. BTF (BPF Type
Format) is the metadata format which encodes the debug info related to BPF
program/map.

[Description](https://git.kernel.org/pub/scm/devel/pahole/pahole.git/tree/man-pages/pahole.1):

> pahole - Shows, manipulates data structure layout and pretty prints raw data.
>
> pahole shows data structure layouts encoded in debugging information formats,
> DWARF, CTF and BTF being supported.
>
> This is useful for, among other things: optimizing important data structures
> by reducing its size, figuring out what is the field sitting at an offset from
> the start of a data structure, investigating ABI changes and more generally
> understanding a new codebase you have to work with.

https://git.kernel.org/pub/scm/devel/pahole/pahole.git/
@pmenzel pmenzel force-pushed the add-libbpf-1.5.0-and-pahole-1.30 branch from ebb3d5c to 48f3140 Compare April 14, 2025 21:15
[BEE] => entering bee_configure() ..
[BEE] cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo /dev/shm/bee-pmenzel/pahole/pahole-1.30-0/source
-- The C compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting BUILD_SHARED_LIBS = ON
-- Checking availability of DWARF and ELF development libraries
-- Looking for dwfl_module_build_id in elf
-- Looking for dwfl_module_build_id in elf - found
-- Found dwarf.h header: /usr/include
-- Found elfutils/libdw.h header: /usr/include
-- Found libdw library: /usr/lib/libdw.so
-- Found libelf library: /usr/lib/libelf.so
-- Checking availability of DWARF and ELF development libraries - done
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.#define ZLIB_VERSION "1.3"")
-- Checking availability of argp library
-- Assuming argp is in libc
-- Checking availability of argp library - done
-- Checking availability of obstack library
-- Assuming obstack is in libc
-- Checking availability of obstack library - done
CMake Error at CMakeLists.txt:75 (message):
  The submodules were not downloaded! GIT_SUBMODULE was turned off or failed.
  Please update submodules and try again.

-- Configuring incomplete, errors occurred!
See also "/dev/shm/bee-pmenzel/pahole/pahole-1.30-0/build/CMakeFiles/CMakeOutput.log".
@pmenzel pmenzel force-pushed the add-libbpf-1.5.0-and-pahole-1.30 branch from 48f3140 to 77205e0 Compare April 14, 2025 21:16
@pmenzel pmenzel merged commit aa6f8ba into master Apr 14, 2025
@pmenzel
Copy link
Collaborator Author

pmenzel commented Apr 14, 2025

Oh no, I messed up:

@deinemuddah:~$ ldd /usr/bin/pahole
	linux-vdso.so.1 => linux-vdso.so.1 (0x00007ffc581f6000)
	libdwarves_emit.so.1 => not found
	libdwarves_reorganize.so.1 => not found
	libdwarves.so.1 => not found
	libdw.so.1 => /lib/libdw.so.1 (0x00007f37b824e000)
	libelf.so.1 => /lib/libelf.so.1 (0x00007f37b8233000)
	libz.so.1 => /lib/libz.so.1 (0x00007f37b8213000)
	libbpf.so.1 => /lib/libbpf.so.1 (0x00007f37b81ae000)
	libc.so.6 => /lib/libc.so.6 (0x00007f37b7fd0000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f37b7fcb000)
	liblzma.so.5 => /lib/liblzma.so.5 (0x00007f37b7fa4000)
	libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f37b7f91000)
	/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f37b82ba000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f37b7f8a000)

Will fix tomorrow afternoon.

@pmenzel
Copy link
Collaborator Author

pmenzel commented Apr 16, 2025

The assume LIBDIR does not contain the prefix:

/usr/usr
/usr/usr/lib
/usr/usr/lib/libdwarves_reorganize.so//libdwarves_reorganize.so.1
/usr/usr/lib/libdwarves_reorganize.so.1//libdwarves_reorganize.so.1.0.0
/usr/usr/lib/libdwarves_reorganize.so.1.0.0
/usr/usr/lib/libdwarves_emit.so//libdwarves_emit.so.1
/usr/usr/lib/libdwarves_emit.so.1//libdwarves_emit.so.1.0.0
/usr/usr/lib/libdwarves_emit.so.1.0.0
/usr/usr/lib/libdwarves.so//libdwarves.so.1
/usr/usr/lib/libdwarves.so.1//libdwarves.so.1.0.0
/usr/usr/lib/libdwarves.so.1.0.0

pmenzel added a commit that referenced this pull request Apr 16, 2025
Currently, [the shared libraries are wrongly installed into
`/usr/usr/lib`][1]:

    $ pahole --version
    pahole: error while loading shared libraries: libdwarves_emit.so.1: cannot open shared object file: No such file or directory
    $ fakeroot bee query pahole-1.30-0.x86_64
    […]
    /usr/usr/lib
    /usr/usr/lib/libdwarves_reorganize.so//libdwarves_reorganize.so.1
    /usr/usr/lib/libdwarves_reorganize.so.1//libdwarves_reorganize.so.1.0.0
    /usr/usr/lib/libdwarves_reorganize.so.1.0.0
    /usr/usr/lib/libdwarves_emit.so//libdwarves_emit.so.1
    /usr/usr/lib/libdwarves_emit.so.1//libdwarves_emit.so.1.0.0
    /usr/usr/lib/libdwarves_emit.so.1.0.0
    /usr/usr/lib/libdwarves.so//libdwarves.so.1
    /usr/usr/lib/libdwarves.so.1//libdwarves.so.1.0.0
    /usr/usr/lib/libdwarves.so.1.0.0
    […]

The problem is, that `CMAKE_INSTALL_LIBDIR` is treated to be
subdirectory of the install prefix and *not* an absolute path:

    $ more CMakeLists.txt
    […]
    if (NOT DEFINED LIB_INSTALL_DIR)
        set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
    endif()
    […]

Explicity set `LIB_INSTALL_DIR` to make the if condition false.

    $ fakeroot bee query pahole-1.30-1.x86_64
    […]
    /usr/lib/libdwarves_reorganize.so//libdwarves_reorganize.so.1
    /usr/lib/libdwarves_reorganize.so.1//libdwarves_reorganize.so.1.0.0
    /usr/lib/libdwarves_reorganize.so.1.0.0
    /usr/lib/libdwarves_emit.so//libdwarves_emit.so.1
    /usr/lib/libdwarves_emit.so.1//libdwarves_emit.so.1.0.0
    /usr/lib/libdwarves_emit.so.1.0.0
    /usr/lib/libdwarves.so//libdwarves.so.1
    /usr/lib/libdwarves.so.1//libdwarves.so.1.0.0
    /usr/lib/libdwarves.so.1.0.0
    […]
    $ pahole --version
    v1.30

Upstream report: https://lore.kernel.org/all/9fb4f7ba-0de1-4f75-9bd2-66212ca8cd86@molgen.mpg.de/

[1]: #3227 (comment)
pmenzel added a commit that referenced this pull request Apr 16, 2025
Currently, [the shared libraries are wrongly installed into
`/usr/usr/lib`][1]:

    $ pahole --version
    pahole: error while loading shared libraries: libdwarves_emit.so.1: cannot open shared object file: No such file or directory
    $ fakeroot bee query pahole-1.30-0.x86_64
    […]
    /usr/usr/lib
    /usr/usr/lib/libdwarves_reorganize.so//libdwarves_reorganize.so.1
    /usr/usr/lib/libdwarves_reorganize.so.1//libdwarves_reorganize.so.1.0.0
    /usr/usr/lib/libdwarves_reorganize.so.1.0.0
    /usr/usr/lib/libdwarves_emit.so//libdwarves_emit.so.1
    /usr/usr/lib/libdwarves_emit.so.1//libdwarves_emit.so.1.0.0
    /usr/usr/lib/libdwarves_emit.so.1.0.0
    /usr/usr/lib/libdwarves.so//libdwarves.so.1
    /usr/usr/lib/libdwarves.so.1//libdwarves.so.1.0.0
    /usr/usr/lib/libdwarves.so.1.0.0
    […]

The problem is, that `CMAKE_INSTALL_LIBDIR` is treated to be
subdirectory of the install prefix and *not* an absolute path:

    $ more CMakeLists.txt
    […]
    if (NOT DEFINED LIB_INSTALL_DIR)
        set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
    endif()
    […]

Explicity set `LIB_INSTALL_DIR` to make the if condition false.

    $ fakeroot bee query pahole-1.30-1.x86_64
    […]
    /usr/lib/libdwarves_reorganize.so//libdwarves_reorganize.so.1
    /usr/lib/libdwarves_reorganize.so.1//libdwarves_reorganize.so.1.0.0
    /usr/lib/libdwarves_reorganize.so.1.0.0
    /usr/lib/libdwarves_emit.so//libdwarves_emit.so.1
    /usr/lib/libdwarves_emit.so.1//libdwarves_emit.so.1.0.0
    /usr/lib/libdwarves_emit.so.1.0.0
    /usr/lib/libdwarves.so//libdwarves.so.1
    /usr/lib/libdwarves.so.1//libdwarves.so.1.0.0
    /usr/lib/libdwarves.so.1.0.0
    […]
    $ pahole --version
    v1.30

Upstream report: https://lore.kernel.org/all/9fb4f7ba-0de1-4f75-9bd2-66212ca8cd86@molgen.mpg.de/

Increment revision to 1.

[1]: #3227 (comment)
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant