-
Notifications
You must be signed in to change notification settings - Fork 59
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
Try System.loadLibrary before trying to extract native libraries from a JAR #1105
Comments
Hi @manosbatsis Thank you for the report. Loading native libraries on JVM are controlled by this file: realm-kotlin/packages/cinterop/src/jvmMain/kotlin/io/realm/kotlin/jvm/SoLoader.kt Line 69 in 4fb30d7
You can also see the logic for where we place the files on disk, which we check before trying to unpack them from the JAR. If you manually install the native code, is it possible for you to place the files at that location? Alternatively we need to find a way that users, like you, can override the default behaviour and manually point to the .so file 🤔 |
Hi @manosbatsis I think a more general approach is to implement #461 which will allow you to bypass the internal loader and then specify the location of the signed/extracted native libs Realm need to load. (without going through extraction/checksum verification etc.) as this will be handled by Conveyor as I understand. |
FYI this is the content of the dependency that Conveyor needs to extract/copy
|
Hiya, The issue here isn't really Conveyor specific. Rather, anyone who wants to package Realm with their (desktop) app and use jlink to create a bundled JVM setup will hit the issue. In a completely normal, old-school JVM bundling setup all shared libraries are placed in the library search path by default, so when the JVM executes Therefore, Realm should really be compatible with this setup and the good news is how easy it is: just run Does that make sense? |
I think it's a good idea to default to |
I think if you try loadLibrary first users won't even need to know, right? If it doesn't work you'll do what you're doing now with extraction from the JAR and everything will be just as it was. It only makes a difference if the user or a tool has done the extraction and placement. |
Fantastic guys, thank you for coming up with the PR so quickly. Looking forward to the snapshot for our dependencies |
@manosbatsis We have released a |
Native library is loaded with the snapshot, thank you @cmelchior |
We use Realm in a multi-platform compose app, one that includes a compose desktop build. Some JVM installers move native shared/JNI libraries are out of the JAR, for a number of reasons, including Windows and macOS security systems' requirement to verify all native code is signed. Conveyor specifically recommends:
From what i can see here, it seems Realm will only use
System.loadLibrary
on Android, which results in exception when trying to initialize our app on desktop JVM apps:The text was updated successfully, but these errors were encountered: