c.f.: https://raw.githubusercontent.com/nmeum/android-tools/237abccb95cadd78f2c431bc34974c2598804c21/patches/core/0022-Use-glibc-s-gettid-when-using-glibc-2.30.patch diff -urpN a/core/libcutils/include/cutils/threads.h b/core/libcutils/include/cutils/threads.h --- a/core/libcutils/include/cutils/threads.h 2018-06-20 17:58:42.000000000 -0700 +++ b/core/libcutils/include/cutils/threads.h 2019-11-12 07:26:44.612266274 -0800 @@ -37,7 +37,9 @@ extern "C" { /***********************************************************************/ /***********************************************************************/ +#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 30) extern pid_t gettid(); +#endif #if !defined(_WIN32) diff -urpN a/core/libcutils/threads.cpp b/core/libcutils/threads.cpp --- a/core/libcutils/threads.cpp 2018-06-20 17:58:42.000000000 -0700 +++ b/core/libcutils/threads.cpp 2019-11-12 07:26:44.612266274 -0800 @@ -32,7 +32,7 @@ #endif // No definition needed for Android because we'll just pick up bionic's copy. -#ifndef __ANDROID__ +#if !defined(__ANDROID__) || !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 30) pid_t gettid() { #if defined(__APPLE__) uint64_t tid;