aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2022-04-22 13:10:31 -0700
committerColin Cross <ccross@android.com>2022-04-22 13:16:32 -0700
commit61b9d9ccc29e1301a06476f0aa5b2e1ab705f10b (patch)
treee89666e108f62e9e4c9553d06e108ac370fe461d
parent7d7be8894e1bc7b2bbe3aeecdd05326cf540cb37 (diff)
downloadbpftool-61b9d9ccc29e1301a06476f0aa5b2e1ab705f10b.tar.gz
Hack around linux/compiler-gcc.h issue with musl
There is an unfortunate interaction between the bionic uapi headers used by musl and the kernel headers distributed with bpftool. The bionic uapi headers include <linux/compiler_types.h>, which they expect to be resolved to their own copy of compiler_types.h that includes compiler.h. It instead resolves to the bpftool copy, which includes compiler-gcc.h directly, triggering an error if the _LINUX_COMPILER_H_ header guard is not already defined. Hack around it by always including linux/compiler.h from the command line. Bug: 190084016 Test: m USE_HOST_MUSL=true Change-Id: I4151ee13e21b9fcdc8a5c504163af280e1ddfbbe
-rw-r--r--Android.bp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
index 4a09836..b83d6ba 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,6 +31,19 @@ cc_binary_host {
"include/uapi",
"src/kernel/bpf"
],
+ target: {
+ musl: {
+ // There is an unfortunate interaction between the bionic uapi headers
+ // used by musl and the kernel headers distributed with bpftool. The
+ // bionic uapi headers include <linux/compiler_types.h>, which they
+ // expect to be resolved to their own copy of compiler_types.h that
+ // includes compiler.h. It instead resolves to the bpftool copy,
+ // which includes compiler-gcc.h directly, triggering an error if
+ // the _LINUX_COMPILER_H_ header guard is not already defined. Hack
+ // around it by always including linux/compiler.h from the command line.
+ cflags: ["-include linux/compiler.h"],
+ },
+ },
static_libs: [
"libbpf",
"libcap",