question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dlopen failed: "/lib-main/libc++_shared.so" is for EM_ARM (40) instead of EM_386 (3)

See original GitHub issue

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.

https://github.com/react-native-mapbox-gl/maps/issues/737

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

82reactions
AndreasBoehmcommented, Aug 5, 2020

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

allprojects {
    repositories {
        google()
        center()
		...

        // force dependency versions on all subprojects
        configurations.all {
            resolutionStrategy {

                // use 0.9.0 to fix crash on Android 11
                force "com.facebook.soloader:soloader:0.9.0"
			}
		}
	}
}
6reactions
sarthakpraneshcommented, Nov 10, 2022

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

allprojects {
    repositories {
        google()
        center()
		...

        // force dependency versions on all subprojects
        configurations.all {
            resolutionStrategy {

                // use 0.9.0 to fix crash on Android 11
                force "com.facebook.soloader:soloader:0.9.0"
			}
		}
	}
}

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 11

Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.myspinny.inspection.rn/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:896)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:725)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:649)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:629)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1024)
       at java.lang.Thread.run(Thread.java:923)
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found