Hack around linux/compiler-gcc.h issue with musl am: 61b9d9ccc2 am: e1bdb0718f am: 85690b6572 am: f91a8a470b am: 89267bdfba
Original change: https://android-review.googlesource.com/c/platform/external/bpftool/+/2072344
Change-Id: I63fb95d6e4efebc86b65b26837743e6a346e5440
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index 4a09836..b83d6ba 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,6 +31,19 @@
"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",