realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH

Open victorjimbei opened this issue 1 year ago • 15 comments

How frequently does the bug occur?

Always

Description

Hello, I was testing our appliaction with an Android emulator with Android 15 with support for 16KB page sizes, and it crashed with the below stacktrace when trying to init the Realm instance.

Stacktrace & log output

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/data/com.example.realmsampleapplication/app_lib/librealm-jni.so.10.18.0" (new hash type from the future?) at java.lang.Runtime.load0(Runtime.java:933) at java.lang.System.load(System.java:1729) at com.getkeepsafe.relinker.SystemLibraryLoader.loadPath(SystemLibraryLoader.java:29) at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:204) at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:136) at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:70) at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:57) at io.realm.internal.RealmCore.loadLibrary(RealmCore.java:60) at io.realm.Realm.initializeRealm(Realm.java:348) at io.realm.Realm.init(Realm.java:263) at com.example.realmsampleapplication.MainActivity.onCreate(MainActivity.kt:20)

Can you reproduce the bug?

Always

Reproduction Steps

I've created a sample app to reproduce this bug and pushed it on github. Steps to reproduce:

  1. Clone the RealmSampleApplication project.
  2. Create an Android emulator following steps from this page: https://developer.android.com/guide/practices/page-sizes#16kb-emulator
  3. Build and run the app.
  4. It will crash as soon as the Realm.init(this) is called.

Version

Java SDK 10.18.0 or Kotlin SDK 1.16.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 15 Beta 2 (Android API VanillaIceCream (Google APIs Page Size 16KB))

Build environment

Android Studio version: Android Studio Koala | 2024.1.1 Beta 2 Android Build Tools version: 35-rc4 Gradle version: 8.4.1

victorjimbei avatar Jun 03 '24 11:06 victorjimbei

➤ PM Bot commented:

Jira ticket: RJAVA-1264

sync-by-unito[bot] avatar Jun 03 '24 11:06 sync-by-unito[bot]

The same issue.

VicMikhailau avatar Jun 04 '24 05:06 VicMikhailau

We are also encountering this issue with the Realm SDK on Android 15 emulators with 16 KB page sizes.

We are in the middle of developing our next official release that will support Android 15, and this issue is critical for our progress. Could you please provide any updates on the status of this issue? Is there a planned fix for both the Java and Kotlin SDKs?

yd-threra-and avatar Jun 17 '24 08:06 yd-threra-and

A similar issue for the kotlin version is in progress.

victorjimbei avatar Jul 02 '24 12:07 victorjimbei

On Realm.init(this); getting the same error in lib version 10.18.0

Fatal Exception: java.lang.UnsatisfiedLinkError
dlopen failed: cannot locate symbol "ExecuteProgram" referenced by "/data/data/com.my.app/app_lib/librealm-jni.so.10.18.0"...
java.lang.Runtime.load0 (Runtime.java:933)
java.lang.System.load (System.java:1729)
com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal (ReLinkerInstance.java:204)
com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary (ReLinkerInstance.java:134)
com.getkeepsafe.relinker.ReLinker.loadLibrary (ReLinker.java:70)
com.getkeepsafe.relinker.ReLinker.loadLibrary (ReLinker.java:57)
io.realm.internal.RealmCore.loadLibrary (RealmCore.java:60)
io.realm.Realm.isInstantApp (Realm.java:318)
io.realm.Realm.initializeRealm (Realm.java:344)
io.realm.Realm.init (Realm.java:47) 

Mihir3646 avatar Jul 10 '24 07:07 Mihir3646

I saw a similar crash with an unrelated cause. I was able to fix it in our NDK project by following the Android guide, Support 16 KB page sizes.

swankjesse avatar Jul 17 '24 14:07 swankjesse

So, is this project now abandoned by MongoDB? This issue here will break all apps using Realm on Android devices with the new 16KB page size and they don't even care.

ridcully99 avatar Jul 30 '24 06:07 ridcully99

So, is this project now abandoned by MongoDB? This issue here will break all apps using Realm on Android devices with the new 16KB page size and they don't even care.

Yes, it's almost 2 months, and still no update on this. Really !!!

Mihir3646 avatar Jul 30 '24 07:07 Mihir3646

I ended up compiling Realm myself with the 16 KB page size flags, and this caused our crash on launch to go away. While it's a pretty simple change, it needs some more thorough testing (esp. with the object server library, which we aren't using in our project). https://github.com/realm/realm-java/pull/7897

mannodermaus avatar Jul 30 '24 23:07 mannodermaus

I am having the same problem on android emulator running android 15 with 16KB page size rom

asadwaheed1 avatar Aug 05 '24 09:08 asadwaheed1

I am facing same issue, when will be the new version released with this fix?

ABINAYASEL avatar Aug 09 '24 05:08 ABINAYASEL

Are there plans to release a new version with this fix in place?

victorjimbei avatar Sep 09 '24 09:09 victorjimbei

We ran into this issue and #7894 appears to have solved it for us. Closing this issue might make sense.

jzbrooks avatar Apr 03 '25 19:04 jzbrooks

I think the 16KB page size issue fixed in version 10.19.0

Mihir3646 avatar Jul 29 '25 08:07 Mihir3646

I think the 16KB page size issue fixed in version 10.19.0

Obviously not, crashes during initialization

I am also using this lib in my project, but resolved it after version update. Did you check proGuard rules?

-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep @interface io.realm.annotations.RealmModule { *; }
-keep class io.realm.annotations.RealmModule { *; }

-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class * { *; }

-keep class io.realm.internal.KeepMember
-keep @io.realm.internal.KeepMember class * { @io.realm.internal.KeepMember *; }

-dontwarn javax.**
-dontwarn io.realm.**
-dontwarn io.reactivex.android.**

-keep class io.realm.RealmCollection
-keep class io.realm.OrderedRealmCollection
-keepclasseswithmembernames class io.realm.** {
    native <methods>;
}

Mihir3646 avatar Jul 30 '25 10:07 Mihir3646