SoLoader: dlopen failed: "/lib-main/libc++_shared.so" is for EM_ARM (40) instead of EM_386 (3)
We’re having .so
loading error when running app on Android emulator R level. Doesn’t seems to appear on API 29.
I’ve verified that the apk has correct architecture in the proper folder:
unzip ./android/app/build/outputs/apk/debug/app-debug.apk -d /tmp/apk-debug
gobjdump -f /tmp/apk-debug/lib/x86/*.so | grep arch
architecture: i386, flags 0x00000150:
After apk install the lib folder contains proper i386 .so-s.
But when starting the app the lib-main
folder contains ARM .so-s.
See the relevant logcat in this gist https://gist.github.com/mfazekas/c593726e061a59d265835ead1c5db0dd
Not sure if related but the log has those line:
2020-04-02 11:21:18.064 10842-10842/com.rnmapboxglexample D/ApkSoSource: allowing consideration of /data/app/~~fFkI_5OwU8XV6z9_a0xypA==/com.rnmapboxglexample-Lwh6zsqdqwYFSjqSz5i5rA==/lib/x86/libc++_shared.so: sysdir file length is 997224, but the file is 575328 bytes long in the APK
I can confirm that he file with length 997224 is 386. The arm version which is incorrectly used has 575328
bytes.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 9
- Comments: 46
Commits related to this issue
- Buildfix (https://github.com/facebook/SoLoader/issues/59) — committed to vaagnavanesyan/piligrim by vaagnavanesyan 4 years ago
I was running into the same issue but wasn’t able to simply upgrade react-native because of some other dependencies.
The fix for this issue is part of SoLoader 0.8.1, you only need to force this dependency to a version higher than 0.8.0.
Root level
build.gradle
Thank you for this fix. It works in most cases but there are still some devices causing issues even after these changes. For example I have seen
One Plus 8 Pro
struggling with a similar issue (stack trace below) on Android 11Still happening to some devices:
Nexus 5X One plus 8 pro
React-Native 0.72.4 Android NDK 23.1.7779620 minSdkVersion 21 compileSdkVersion 33 targetSdkVersion 33
Ditto.
I’m seeing this with oneplus8pro and soloader 10.5 as well:
What’s more confusing to me is: oneplus8pro seems to be a 64-bit ARM device, yet the code is expecting EM_X86_64 instead of EM_AARCH64…?
Unfortunately for now, I’ve had to shift away from using Hermes 😭 … and since oneplus8pro is ARM 64-bit, it doesn’t seem like I can build another bundle targeting just that…
Anyone have any other ideas on things to try?
I also have the error showing up in my crashlytics:
Device Brand: OnePlus Model: OnePlus8Pro Operating system Version: Android 11 Rooted: Yes
We’re also seeing this crash with RN 0.71.6 and SoLoader 0.10.4 on a OnePlus 8 Pro device running Android 11.
I though I had solved the issue by upgrading to
soloader:0.10.4+
as suggested by Google support but it doesn’t seems so.Here is my current config on react native
0.71.2
. Inapp/build.gradle
I have something like this:In
build.gradle
I have:We’re seeing this on devices such as Galaxy S9, One Plus 8, One Plus 5T,HUAWEI P30 All running Android 10.
React Native 0.70.6 React Native Gradle Plugin 0.70.3
+1 we have same issue here, any solution lately?
Seeing this issue as well.
RN: 0.72.7
` buildToolsVersion = “33.0.0” minSdkVersion = 23 compileSdkVersion = 33 targetSdkVersion = 33 kotlin_version = ‘1.6.10’ // <- add this line ndkVersion = “21.4.7075529”
Brand:Google Model:Pixel 6 Pro Orientation:Portrait RAM free: 1.88 GB Disk free: 1.58 GB
Operating System Version:Android 12 Orientation:Portrait Rooted:No
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/watch.panpan/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127) at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772) at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:26)
+1 having the same issue on OnePlus8Pro with Android 11
This made my day. I was trying to make the apk from last 6 hours
Same issue,
One Plus 8 Pro Android 11
“react-native”: “0.71.3”
if (hermesEnabled.toBoolean()) { implementation(“com.facebook.react:hermes-android”) } else { implementation jscFlavor }
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes.so caused by: couldn’t find DSO to load: libjsi.so caused by: couldn’t find DSO to load: libfolly_runtime.so caused by: couldn’t find DSO to load: libglog.so caused by: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: “/data/data/{mypackagename}/lib-3/libc++_shared.so” is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0
We have the same issue.
Android 8 & 11 Nexus 5X One Plus 8 Pro
“react-native”: “0.72.4”
Apparently SoLoader issues are supposed to be fixed on React Native 72. I’ve just released a new version of my app and will see if that fixes it
We noticed in our app it’s mostly Android 8 and Android 11 on Google and OnePlus devices that it’s happening.
@RohovDmytro I have no idea, the problem with this issue is that I can’t reproduce it myself, I only see crashlytics logs of customers experiencing the crash.
@sarthakpranesh we had the same issue in the exact same setup.
Upgrading from React-Native 0.61 to 0.63 solved it for us.
Any input on the above?! I’d be happy to debug it, but I’d need some hints to where to look.
One thing that i found is that on old emulators - API 27 -
SysUtils.getSupportedAbis()
return 'x86` only,while on devices we’re having the issue with - API R -
SysUtils.getSupportedAbis()
return 'x86,
armeabi-v7`Apparently they do seems to have some support for both
x86
and some kind ofarm
emulation.https://developer.android.com/studio/releases/emulator#support_for_arm_binaries_on_android_9_and_11_system_images