bpf: fix cross build failure on Debian
authorHelmut Grohne <helmut@subdivi.de>
Mon, 30 Sep 2024 15:56:18 +0000 (17:56 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 1 Oct 2024 20:08:06 +0000 (22:08 +0200)
commit608009dc6218f7c41420f665586f2449b64a08f7
tree2353908f4bba626a99b88f5874264d29c8816a9d
parent5b80cef69f00052977ae51d27f21c631266a57ec
bpf: fix cross build failure on Debian

For compiling bpf code, the system include directory needs to be
constructed. On Debian-like systems, this requires passing a multiarch
directory. Since clang's -dump-machine prints something other that the
multiarch triplet, gcc was interrogated earlier, but that also yields a
wrong result for cross compilation and was thus skipped resulting in
clang not finding asm/types.h.

Rather than, -dump-machine we should ask for -print-multiarch (which
rarely differs). Whenever gcc is in use, this is right (even for cross
building). Since clang does not support -print-multiarch and its
-dump-machine never matches Debian's multiarch, we resort to asking gcc
when building natively. For cross builds using clang, we are out of
luck.
meson.build