diff options
author | Colin Cross <ccross@android.com> | 2022-04-22 13:10:31 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2022-04-22 13:16:32 -0700 |
commit | 61b9d9ccc29e1301a06476f0aa5b2e1ab705f10b (patch) | |
tree | e89666e108f62e9e4c9553d06e108ac370fe461d | |
parent | 7d7be8894e1bc7b2bbe3aeecdd05326cf540cb37 (diff) | |
download | bpftool-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.bp | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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", |