Skip to content

Commit

Permalink
Fix posix_memalign symbol not found with Android API 16 (#953)
Browse files Browse the repository at this point in the history
Summary:
According to this android/ndk#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: facebook/react-native#20302 and facebook/react-native#20342
Pull Request resolved: #953

Reviewed By: yfeldblum

Differential Revision: D10469757

Pulled By: Orvid

fbshipit-source-id: c63838f3f6e723ef3de77187f39597a4063043db
  • Loading branch information
Kudo authored and facebook-github-bot committed Oct 19, 2018
1 parent 4cabbe6 commit c831d06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit c831d06

Please sign in to comment.