-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[META] Build with Clang (Android) #20342
Comments
I was able to compile RN with NDK r17, and will create a PR once #19945 is merged. |
Amazing job,thanks. |
If I understood correctly, iOS builds with clang agains libc++ and with almost the same native dependencies. So it won't be a big problem to build with Clang, but to use libc++ we may need to build JSC against it. Please correct me if wrong |
I'm not that proficient in C++ and don't know much about RN internals, therefore cannot make changes to C++ code to make it compile with Clang. @hramos could you please find someone from Facebook to help with it. |
NDK r17b landed 6117a6c |
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
RN master now use clang |
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: facebook#953 Reviewed By: yfeldblum Differential Revision: D10469757 Pulled By: Orvid fbshipit-source-id: c63838f3f6e723ef3de77187f39597a4063043db
For Discussion
The purpose of this issue is to create a "single point of truth" regarding the efforts related to building React Native using Clang and against libc++, in order to coordinate and recap all the efforts connected to this subject.
Background
Android NDK is about to drop GCC and GNU STL support in favor of Clang and libc++ in version 18. Below are notable changes in NDK
Version 11
Version 13
Version 14
Version 16
Version 17
gnustl and stlport are deprecated and will be removed in NDK r18.
Documentations
TODO
How to
Compile with Clang
Open
ReactAndroid/src/main/jni/Application.mk
and remove or comment out NDK_TOOLCHAIN_VERSIONCompile with against libc++
Open
ReactAndroid/src/main/jni/Application.mk
and setAPP_STL := c++_shared
Related issues
Related PRs
The text was updated successfully, but these errors were encountered: