bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Building with CMAKE_USE_LIBBPF_PACKAGE requires v5.17 kernel headers (for struct bpf_core_relo)

Open daniel-thompson opened this issue 3 years ago • 2 comments

For reasons unrelated to bcc itself (https://github.com/iovisor/bpftrace/issues/2173 ) I have been trying to compile bcc using the CMAKE_USE_LIBBPF_PACKAGE.

Currently this is failing to build for me (bcc-0.24, libbpf-0.7, kernel headers v5.15). The cause is the combination of v5.15 headers and https://github.com/iovisor/bcc/commit/9fce5059307c2f7ea42c2a7e4fee4c1bd82e0b7e . That's because the newly vendored code evaluates sizeof(struct bpf_core_relo) and these structures were not introduced until the v5.17 kernel headers.

Currently I am using the following workaround: https://github.com/kraj/meta-clang/pull/613/files/3b8d04d0e16f91f7983af7476321f932b1302e52#diff-506de8fdad35abe61aa0e0fb90bf8fd0babe71717fa6cb5055dedc967013fe80

I'd originally assumed this isn't applicable upstream... but then I realized the C++ namespacing might mean its perfectly find to vendor header code like this!

Is this kind of change suitable for bcc or is there a better solution?

daniel-thompson avatar May 25 '22 16:05 daniel-thompson

@olsajiri could you help take a look at this issue?

yonghong-song avatar May 26 '22 23:05 yonghong-song

libbpf comes with its own UAPI headers, but it's not installed by default.

@daniel-thompson Could you try this:

$ make install_uapi_headers

chenhengqi avatar May 31 '22 12:05 chenhengqi