From e9cb616a608c4cb8b0d1cc66758ca44cdc22a8ce Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Fri, 19 Oct 2018 16:31:37 -0700 Subject: [PATCH] Fix posix_memalign symbol not found with Android API 16 (#953) Summary: According to this https://github.com/android-ndk/ndk/issues/647, posix_memalign may not exist on Android API 16. From Android NDK r17c, the API exists for Android API 17+. ``` #if __ANDROID_API__ >= 17 int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(17); #endif /* __ANDROID_API__ >= 17 */ ``` Change the code to use posix_memalign only after Android API 17+. This would also fix issue for OSS React Native to pack latest folly and building with clang. See: https://github.com/facebook/react-native/issues/20302 and https://github.com/facebook/react-native/issues/20342 Pull Request resolved: https://github.com/facebook/folly/pull/953 Reviewed By: yfeldblum Differential Revision: D10469757 Pulled By: Orvid fbshipit-source-id: c63838f3f6e723ef3de77187f39597a4063043db --- folly/Memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/Memory.h b/folly/Memory.h index cec1fd4650b..0e19155a629 100644 --- a/folly/Memory.h +++ b/folly/Memory.h @@ -39,7 +39,7 @@ namespace folly { #if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || \ - (defined(__ANDROID__) && (__ANDROID_API__ > 15)) || \ + (defined(__ANDROID__) && (__ANDROID_API__ > 16)) || \ (defined(__APPLE__) && \ (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 || \ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0))