Skip to content
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

add x86_64 arm64-v8a support. Fixes #2814 #18754

Closed
wants to merge 5 commits into from

Conversation

gengjiawen
Copy link
Contributor

@gengjiawen gengjiawen commented Apr 8, 2018

Motivaion

add arm64 support, related issue : #2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebookarchive/android-jsc#30 first and do a new release.

Test Plan

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

Related PRs

facebookarchive/android-jsc#30.

Release Notes

[ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 8, 2018
@gengjiawen gengjiawen changed the title [WIP]Feature/x64 support add arm64 and x86_64 support Apr 9, 2018
@hwangjr
Copy link

hwangjr commented May 5, 2018

any progress about this support?

@facebook-github-bot

This comment has been minimized.

@gengjiawen
Copy link
Contributor Author

@hramos Can you help on this ?

@hramos
Copy link
Contributor

hramos commented May 14, 2018

I'm not the right person to review this, sorry.

@hwangjr
Copy link

hwangjr commented May 15, 2018

@hramos maybe you know the right person?

@hramos
Copy link
Contributor

hramos commented Jun 15, 2018

@mdvacca

@hramos hramos added the Platform: Android Android applications. label Jun 15, 2018
@gengjiawen
Copy link
Contributor Author

gengjiawen commented Jun 16, 2018

@hramos Why push commit to this pr. If we the new jsc is using internal by facebook, this #19536 is pr I more prefered.

@facebook-github-bot

This comment has been minimized.

@gengjiawen
Copy link
Contributor Author

@mdvacca Any thought to merge this or wait for user-specific jsc support ?

@gengjiawen gengjiawen changed the title add arm64 and x86_64 support Fixes #2814 Aug 21, 2018
@gengjiawen
Copy link
Contributor Author

We have been stuck with #2814 too long, maybe merge this first.

@hramos hramos changed the title Fixes #2814 Add arm64 support Aug 21, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@gengjiawen
Copy link
Contributor Author

Looks like take too long to import. @hramos

@CoreFloDev
Copy link

One quick question about this. How can we guaranty that there is no keylogger or bitcoin mining program inside the binary and it is doing only what it is suppose to do?

@gengjiawen
Copy link
Contributor Author

get the so to any virus scan software or push fb to merge my pr to android-jsc.

@hramos
Copy link
Contributor

hramos commented Sep 24, 2018

The import failed due to a binary size limit. I've whitelisted the PR and I am trying to land this again. Please do not add any commits, to ensure the land is not cancelled.

facebook-github-bot pushed a commit that referenced this pull request Sep 24, 2018
Summary:
add arm64 support, related issue : #2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebookarchive/android-jsc#30 first and do a new release.

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

facebookarchive/android-jsc#30.

 [ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

Differential Revision: D9491481

Pulled By: hramos

fbshipit-source-id: d6ec6992768eb0c0866a0317273e09fae5b8935e
@hramos hramos closed this Sep 24, 2018
@hramos hramos added this to the 0.58 RC milestone Sep 25, 2018
@RSNara
Copy link
Contributor

RSNara commented Sep 27, 2018

@gengjiawen. So I generate a new project using react-native init. When I try to run the android version of the generated project, it insta-crashes after metro sends the bundle over. Here's the error that adb logcat logs:

09-27 08:37:10.889 16947 17028 D SoLoader: About to load: libreactnativejni.so
09-27 08:37:10.890 16947 17028 D SoLoader: libreactnativejni.so found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.897 16947 17028 D SoLoader: Loading lib dependencies: [libglog_init.so, libyoga.so, libprivatedata.so, libfb.so, libfolly_json.so, libjsc.so, libglog.so, libgnustl_shared.so, libandroid.so, liblog.so, libstdc++.so, libm.so, libc.so, libdl.so]
09-27 08:37:10.897 16947 17028 D SoLoader: About to load: libglog_init.so
09-27 08:37:10.898 16947 17028 D SoLoader: libglog_init.so found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.898 16947 17028 D SoLoader: Loading lib dependencies: [libglog.so, libgnustl_shared.so, liblog.so, libstdc++.so, libm.so, libc.so, libdl.so]
09-27 08:37:10.899 16947 17028 D SoLoader: About to load: libglog.so
09-27 08:37:10.899 16947 17028 D SoLoader: libglog.so found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.901 16947 17028 D SoLoader: Loading lib dependencies: [libgnustl_shared.so, libstdc++.so, libm.so, libc.so, libdl.so]
09-27 08:37:10.901 16947 17028 D SoLoader: About to load: libgnustl_shared.so
09-27 08:37:10.901 16947 17028 D SoLoader: libgnustl_shared.so found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.902 16947 17028 D SoLoader: Loading lib dependencies: [libm.so, libc.so, libdl.so]
09-27 08:37:10.902 16947 17028 D SoLoader: About to load: libm.so
09-27 08:37:10.903 16947 17028 D SoLoader: libm.so not found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.903 16947 17028 D SoLoader: libm.so not found on /data/app/com.rnapp1538062456-1/lib/x86_64
09-27 08:37:10.903 16947 17028 D SoLoader: libm.so not found on /system/vendor/lib
09-27 08:37:10.903 16947 17028 D SoLoader: libm.so found on /system/lib
09-27 08:37:10.903 16947 17028 D SoLoader: libm.so loaded implicitly
09-27 08:37:10.903 16947 17028 D SoLoader: Loaded: libm.so
09-27 08:37:10.903 16947 17028 D SoLoader: About to load: libc.so
09-27 08:37:10.903 16947 17028 D SoLoader: libc.so not found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.903 16947 17028 D SoLoader: libc.so not found on /data/app/com.rnapp1538062456-1/lib/x86_64
09-27 08:37:10.903 16947 17028 D SoLoader: libc.so not found on /system/vendor/lib
09-27 08:37:10.904 16947 17028 D SoLoader: libc.so found on /system/lib
09-27 08:37:10.904 16947 17028 D SoLoader: libc.so loaded implicitly
09-27 08:37:10.904 16947 17028 D SoLoader: Loaded: libc.so
09-27 08:37:10.904 16947 17028 D SoLoader: About to load: libdl.so
09-27 08:37:10.904 16947 17028 D SoLoader: libdl.so not found on /data/data/com.rnapp1538062456/lib-main
09-27 08:37:10.904 16947 17028 D SoLoader: libdl.so not found on /data/app/com.rnapp1538062456-1/lib/x86_64
09-27 08:37:10.904 16947 17028 D SoLoader: libdl.so not found on /system/vendor/lib
09-27 08:37:10.904 16947 17028 D SoLoader: libdl.so found on /system/lib
09-27 08:37:10.904 16947 17028 D SoLoader: libdl.so loaded implicitly
09-27 08:37:10.904 16947 17028 D SoLoader: Loaded: libdl.so
09-27 08:37:10.910 16947 17028 E SoLoader: Error when loading lib: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit lib hash: 38099cfdfc816f823cb69c5387381ddd search path is /data/app/com.rnapp1538062456-1/lib/x86_64
09-27 08:37:10.910 16947 17028 E SoLoader: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
09-27 08:37:10.910 16947 17028 E SoLoader: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
09-27 08:37:10.910 16947 17028 E SoLoader: couldn't find DSO to load: libglog_init.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
09-27 08:37:10.910 16947 17028 E SoLoader: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libglog_init.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
09-27 08:37:10.910 16947 17028 E AndroidRuntime: FATAL EXCEPTION: Thread-2
09-27 08:37:10.910 16947 17028 E AndroidRuntime: Process: com.rnapp1538062456, PID: 16947
09-27 08:37:10.910 16947 17028 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libglog_init.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libgnustl_shared.so caused by: dlopen failed: "/data/data/com.rnapp1538062456/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:703)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:564)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:500)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:455)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:18)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create(JSCJavaScriptExecutorFactory.java:21)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:914)
09-27 08:37:10.910 16947 17028 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:761)
09-27 08:37:10.922  1617  2151 W ActivityManager:   Force finishing activity com.rnapp1538062456/.MainActivity
09-27 08:37:10.954  1313  2102 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 2691072

Pretty sure this commit is the problem since its parent works fine, but this commit doesn't. Are you familiar with what could have caused this problem, @gengjiawen?

@gengjiawen
Copy link
Contributor Author

what device are you running ? Is it a x86_64 emulator ?

@kelset
Copy link
Contributor

kelset commented Sep 28, 2018

@RSNara did you pass some custom parameters to react-native init? Because I don't think this commit is available in any release yet (current latest 0.57.1) 🤔

@RSNara
Copy link
Contributor

RSNara commented Sep 28, 2018

@kelset I used node react-native-cli/index.js init <app-name> to generate the project.

@gengjiawen It's a x86_64 emulator. Here are the details (from IntelliJ):

Name: fb_default_emulator
CPU/ABI: Google APIs Intel Atom (x86_64)
Path: /Users/ramanpreet/.android/avd/fb_default_emulator.avd
Target: google_apis [Google APIs] (API level 24)
SD Card: 1000M
hw.dPad: no
hw.lcd.height: 1920
hw.accelerometer: yes
hw.device.name: Nexus 5X
hw.device.manufacturer: Google
hw.lcd.width: 1080
hw.gps: yes
image.androidVersion.api: 24
hw.audioInput: yes
image.sysdir.1: system-images/android-24/google_apis/x86_64/
tag.id: google_apis
hw.mainKeys: no
hw.lcd.density: 420
hw.device.hash2: MD5:bc5032b2a871da511332401af3ac6bb0
hw.trackBall: no
PlayStore.enabled: false
hw.battery: yes
hw.sdCard: yes
tag.display: Google APIs
hw.keyboard: yes
hw.sensors.proximity: yes
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8

@gengjiawen
Copy link
Contributor Author

I doesn't put x86_64 abi in template, only in RNTester. Normally from my experience a x86 emulator is sufficient.

@RSNara
Copy link
Contributor

RSNara commented Sep 28, 2018

@gengjiawen, I'm not sure I follow your comment. What concrete steps can we take to fix this?

@gengjiawen
Copy link
Contributor Author

If you want to run this on x86_64 emulator, add x86_64 to this line https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/android/app/build.gradle#L112.

@RSNara
Copy link
Contributor

RSNara commented Oct 3, 2018

@gengjiawen, I just added x86_64 to that line and rebuilt a starter project, and still no luck. Should making that change be sufficient to get the android starter working?

@gengjiawen
Copy link
Contributor Author

@RSNara Can you try RNTester on that emulator ?

@RSNara
Copy link
Contributor

RSNara commented Oct 3, 2018

@gengjiawen RNTester works fine.

In case you're curious, here's the script I'm using to create a react native project:

#/bin/bash

set -e

APP_NAME=rnapp$(date +%s)
RN_GITUB=~/fbsource/xplat/js/react-native-github

echo 'Installing dependencies...'
cd $RN_GITHUB
npm install prompt
echo ''

echo 'Temporarily modify local files'
sed -i '' "s/execSync(installCommand/execSync('yarn link react-native'/g" $RN_GITHUB/react-native-cli/index.js
sed -i '' "s|ReactNativeVersionCheck.checkVersions();|// ReactNativeVersionCheck.checkVersions();|g" $RN_GITHUB/Libraries/Core/InitializeCore.js
echo ''

echo 'Link react-native'
yarn link
echo ''

echo "Create react-native app: $APP_NAME"
node ./react-native-cli/index.js init $APP_NAME
cd $APP_NAME && npm install react-native
echo ''

echo "Copy source files into \"$APP_NAME\""
cp -r ../{React,ReactAndroid,ReactCommon,Libraries} ./node_modules/react-native
echo ''

echo "Move \"$APP_NAME\" to desktop"
cd .. && mv $APP_NAME ~/Desktop/$APP_NAME
echo ''

echo "Undo file modifications"
sed -i '' "s/execSync('yarn link react-native'/execSync(installCommand/g" $RN_GITHUB/react-native-cli/index.js
sed -i '' "s|// ReactNativeVersionCheck.checkVersions();|ReactNativeVersionCheck.checkVersions();|g" $RN_GITHUB/Libraries/Core/InitializeCore.js
echo ''

echo "Generated app: $APP_NAME"
echo "Run \"cd ~/Desktop/$APP_NAME\" to get to app"
echo 'Run "yarn start" to start metro'
echo 'Run "yarn android" to install to a running android emulator'
echo 'Run "yarn ios" to open up and install to an ios emulator'

@gengjiawen
Copy link
Contributor Author

Can you check the so in the generated apk using android studio ?

janicduplessis added a commit to janicduplessis/react-native that referenced this pull request Oct 13, 2018
@Kudo Kudo mentioned this pull request Oct 19, 2018
janicduplessis added a commit to janicduplessis/react-native that referenced this pull request Nov 3, 2018
kmagiera added a commit to kmagiera/react-native that referenced this pull request Nov 15, 2018
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
Summary:
add arm64 support, related issue : facebook#2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebookarchive/android-jsc#30 first and do a new release.

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

facebookarchive/android-jsc#30.

 [ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

Differential Revision: D9491481

Pulled By: hramos

fbshipit-source-id: d6ec6992768eb0c0866a0317273e09fae5b8935e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants