Uh oh!
There was an error while loading. Please reload this page.
[ANDROID] [ENHANCEMENT] [build] - Use clang to build Android libraries - #21863
[ANDROID] [ENHANCEMENT] [build] - Use clang to build Android libraries #21863Kudo wants to merge 1 commit into
Conversation
dulmandakh
commented
Oct 22, 2018
@Kudo it seems that folly is merged your PR, so that you can proceed with upgrading folly 👍 |
Kudo
commented
Oct 23, 2018
@dulmandakh Updated to folly 2018.10.22 that included the fix. |
dulmandakh
commented
Oct 23, 2018
via email
Cool, did you tried to upgrade folly for iOS? |
Kudo
commented
Oct 23, 2018
@dulmandakh61f8b05 and cdc70e7 upgrade folly for iOS and checked CocoaPods not broken. Please also take a look. Thank you. |
hey99xx
commented
Oct 23, 2018
You should continue with making android-jsc build with libc++, with the assumption that jsc-android-buildscripts will not be ready for a while. See #19536 (comment) |
There was a problem hiding this comment.
I think that it might be better to stick to gnustl when we still use gcc
There was a problem hiding this comment.
Well, the main purpose of this PR is to use clang build, so here to drop gnustl_shared and gcc.
Kudo
commented
Oct 24, 2018
@hey99xx I see @gengjiawen's changes from facebookarchive/android-jsc#30 and the Dockerfile at https://github.com/gengjiawen/android-ndk. Thanks for @gengjiawen's awesome work. I am trying to build JSC with clang but pretty not sure if the old JSC r174650 could build with clang or not. |
Kudo
commented
Oct 24, 2018
Unfortunately, JSC r174650 does not directly support clang. |
gengjiawen
commented
Oct 24, 2018
If we don't upgrade jsc, will it cause problem ? |
@gengjiawen If we use android-jsc as is, we'd need both libgnustl_shared.so and libc++_shared.so in the app as mentioned in Kudo's workaround in the PR. Not sure if that causes any problem in runtime or not (*), but certainly a pointless app size increase. So updating existing android-jsc to use libc++_shared.so is the best looking option for me. @Kudo Nothing in WebKit/WebKit@d656310 or https://bugs.webkit.org/show_bug.cgi?id=146833 tells me r174650 didn't support clang. Edit: (*) I see @dulmandakh also mentioned in #20342 (comment)
|
dulmandakh
commented
Oct 25, 2018
@Kudo thank you for your effort to land latest folly and clang migration. Just now, I fetched your branch and did some quick tests. I can build RN and RNTester app without any problems, but RNTester app is failing on startup. A while ago I managed to compile RN with clang against libc++, and RNTester app was failing to launch. I think that cause is described at #21863 (comment). Also I learned that small and specific PRs are reviewed/merged sooner than a PR that touches many things. So I would like to ask you to split this PR into smaller ones that only upgrades folly, migrates to clang and libc++, Gradle cleanup and so on. |
Kudo
commented
Oct 26, 2018
@hey99xx Yes, just as you understood, @dulmandakh You could check the adb log, if there are errors like libgnustl_shared.so not found, that is the problem. |
Kudo
commented
Oct 27, 2018
@dulmandakh Opened PRs for just upgrade folly. #21976 for iOS and #21977 for Android. |
dulmandakh
commented
Oct 29, 2018
@Kudo thank you for your hard work, folly is now up to date. |
Kudo
commented
Oct 30, 2018
@dulmandakh Thanks for your coordinating. |
dulmandakh
commented
Oct 31, 2018
@Kudo do you have experience with CMake? If yes, will it make Android development and build easier, faster? |
Kudo
commented
Oct 31, 2018
@dulmandakh
In summary, I don't see much benefits in the short term. Migrate to CMake currently is just to rewrite Android.mk with CMakeLists.txt. |
cdc70e7 to
68024f4CompareKudo
commented
Oct 31, 2018
I've updated this PR to only for clang build support and remove previous folly changes. With some enhancements from original work:
CI build log: https://travis-ci.org/Kudo/android-jsc/builds/448793745 Migration Guide:
|
hey99xx
commented
Nov 1, 2018
WOW this is absolutely fantastic, truly well done. I don't know if anyone will land Kudo/android-jsc@0437216 in main facebook/android-jsc repo. You're building on top of facebookarchive/android-jsc#30 but they're not taking that PR either, that's why @gengjiawen had checked in the pre-built AAR in #18754. So in this case it may make sense for you to do the same thing. The only thing is file hashes for all pre-built libjsc.so files would be changing this time, and I don't know if Facebook would trust on .so files built on someone else's computer and put them in their OSS builds. |
hey99xx
commented
Nov 1, 2018
Also quick question: The new JSC in NPM ships with libjsc and libc++_shared ( |
dulmandakh
commented
Nov 1, 2018
personally I cannot use it because it's minSDK is 21, but I want support for Android 4.x |
Kudo
commented
Nov 1, 2018
@hey99xx Nice finding for your libc++_shared.so. Yes, after this PR, there should have a libc++_shared.so conflict if going to apply The new JSC in NPM . @dulmandakh |
dulmandakh
commented
Nov 1, 2018
@Kudo it's about android-jsc package on NPM, which requires to set minSdkVersion to 21. |
Kudo
commented
Nov 1, 2018
@dulmandakh Oops, I see and sorry for my misunderstood. |
dulmandakh
commented
Nov 1, 2018
@Kudo is it possible to have CMake configuration for Folly in RN repo, so we don't have wait for folly developers if we need change? |
fkgozali
commented
Nov 1, 2018
Yeah, agreed. This is probably something we can ask the folly repo for? E.g. have a subset specifically for mobile? |
dulmandakh
commented
Nov 1, 2018
I think it might be better to maintain CMake configuration for Folly in RN repo if possible, because we don't have to wait for a new folly release if we need some change. Maintaining configuration in folly repo might be normal for FB RN, but sometimes it breaks open source CI due to fact that some changes might not be released to open source. FYI, case with Buck b40e23d. |
fkgozali
commented
Nov 2, 2018
This is a fair point, and I'm okay with having RN-specific config (that can be shared across all platforms as needed - ios/anroid/others) |
Kudo
commented
Nov 3, 2018
Well, I could try to investigate the possibility to CMake migration for both iOS/Android later. |
dulmandakh
commented
Nov 3, 2018
@Kudo I personally prefer more incremental approach to a technical solution. I was thinking if it's possible to build current JSC with clang, then update JSC version. |
Kudo
commented
Nov 3, 2018
@dulmandakh Yes, my commit is current JSC r174650 build with clang. |
akshetpandey
commented
Nov 8, 2018
It seems it would be easier to have a fb employee bundle a prebuilt jsc as is done on master right now... |
akshetpandey
commented
Nov 12, 2018
#22231 |
hey99xx
commented
Nov 13, 2018
@akshetpandey This PR plans to handle android-jsc's dependency on gnustl. See the checklist at the top:
The other PR seems to have the same goal as this, but doesn't address android-jsc's dependency on gnustl at all, I don't know if that's correct thing to do. @Kudo@gengjiawen what do you think? |
akshetpandey
commented
Nov 13, 2018
Doesn't look like the jsc PR is going to land. I am using this PR with a locally compiled android-jsc in my fork. |
Kudo
commented
Dec 28, 2018
Close this in favor of #22263 |
Fixes#20342 and support for future NDK r18
TODO:
- [x] Wait folly merged with this fixWait android-jsc with clang built. See [META] Upgrading Folly #20302 (comment) for details.Workaround to test without clang android-jsc: put libgnustl_shared.so directly into apk, i.e. will have both libstd++ (for JSC) and libc++ (for libreactnativejni.so) runtime.
Or maybe try to use community maintained android-jsc which is built by clang.
JSC should also built by clang. Wait for Kudo/android-jsc@0437216 landed.
- [x] Upgrade iOS folly version as wellTest Plan:
Test by RNTester
Release Notes:
[ANDROID] [ENHANCEMENT] [build] - Use clang to build Android libraries