Android: use unified headers from the NDK
See https://android.googlesource.com/platform/ndk/+/master/docs/UnifiedHeaders.md
The NDK has switched to a new sysroot which has unified headers. These
headers are newer and contain updated definitions for recent syscalls
that we need (memfd_create)
Change-Id: I464a0520e0765864f1a7af1e1eaddc5367a15933
diff --git a/build/BUILD.gn b/build/BUILD.gn
index 3a48665..3258166 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -107,9 +107,11 @@
if (is_android) {
asmflags += [ "--target=$android_abi_target" ]
cflags += [
- "-isystem$android_ndk_root/$android_sysroot_subdir/usr/include",
- "--sysroot=$android_ndk_root/$android_sysroot_subdir",
+ "--sysroot=$android_compile_sysroot",
+ "-isystem$android_compile_sysroot/$android_compile_sysroot_subdir",
+ "-isystem$android_compile_sysroot",
"-DANDROID",
+ "-D__ANDROID_API__=21",
"--target=$android_abi_target",
]
cflags_cc += [
@@ -121,7 +123,7 @@
"-Wl,-z,nocopyreloc",
"-gcc-toolchain",
"$android_toolchain_root",
- "--sysroot=$android_ndk_root/$android_sysroot_subdir",
+ "--sysroot=$android_ndk_root/$android_link_sysroot_subdir",
"--target=$android_abi_target",
"-Wl,--exclude-libs,libunwind.a",
"-Wl,--exclude-libs,libgcc.a",
@@ -134,10 +136,7 @@
"-Wl,--warn-shared-textrel",
"-Wl,--fatal-warnings",
]
- lib_dirs = [
- "$android_ndk_root/sources/cxx-stl/llvm-libc++/libs/$android_app_abi",
- "$android_ndk_root/$android_sysroot_subdir/usr/lib",
- ]
+ lib_dirs = [ "$android_ndk_root/sources/cxx-stl/llvm-libc++/libs/$android_app_abi" ]
libs += [
"gcc",
"c++_static",