@@ -28,6 +28,17 @@ inherit bash-completion cmake ptest pkgconfig
export DEBUG_PREFIX_MAP
+# cmake/BuildBPF.cmake compiles the BPF data source with the plain gcc it finds
+# in PATH, i.e. the build host's compiler (see its own commentary for why it has
+# to be gcc), and 0001-cmake-BuildBPF.cmake-introduce-DEBUG_PREFIX_MAP.patch
+# hands it DEBUG_PREFIX_MAP so the embedded objects do not leak build paths.
+# -fcanon-prefix-map, which DEBUG_PREFIX_MAP_EXTRA adds for the gcc toolchain,
+# only exists in GCC >= 13: the target compiler always has it, the build host's
+# gcc may not, and then the build dies with
+# gcc: error: unrecognized command-line option '-fcanon-prefix-map'
+# The -ffile-prefix-map= rewrites are all this needs, so drop the extra.
+DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
+
PACKAGECONFIG ?= " \
${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)} \
cmake/BuildBPF.cmake compiles the BPF data source with the plain gcc it finds in PATH (find_program(GCC gcc)) rather than with the cross compiler, because the BTF encoding step needs gcc plus pahole. The recipe exports DEBUG_PREFIX_MAP and 0001-cmake-BuildBPF.cmake-introduce-DEBUG_PREFIX_MAP.patch hands it to that command so the embedded objects do not carry build paths. DEBUG_PREFIX_MAP also picks up DEBUG_PREFIX_MAP_EXTRA, which is -fcanon-prefix-map for the gcc toolchain (meta/classes/toolchain/gcc.bbclass). That option only exists in GCC >= 13: the cross compiler always has it, the build host's gcc may not, and the ptest enabled build then fails with gcc: error: unrecognized command-line option '-fcanon-prefix-map'; did you mean '-fmacro-prefix-map='? Drop it, the way frr and kernel-selftest already do for the same reason. The four -ffile-prefix-map= rewrites are all this needs: with the extra removed tests/data/data_source.o still contains no build paths, only /usr/src/debug/bpftrace/0.26.1. Signed-off-by: Khem Raj <raj.khem@gmail.com> --- .../recipes-devtools/bpftrace/bpftrace_0.26.1.bb | 11 +++++++++++ 1 file changed, 11 insertions(+)