-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by libsubstrate.so #3406
Comments
Does this issue occur with GraalVM CE java11 21.1.0 (without Gluon)? |
After some digging, this appears to be an issue with using classes from the package I believe you can reproduce this issue by including some usage of |
I've also confirmed that this issues still does occur with GraalVM CE java11 21.1.0 without gluon |
Could you please provide a detailed step for reproducing the issue locally? thank you |
I am having exactly same issue too, Using
|
I was able to reproduce this with only small changes to any project. For my example I was using the Adding the below apache-configuration2 dependency and including the below reflection config will result in the error specified above when the app is first launched on android. Added pom dependency
reflect-config.json
|
I'm having issues with reproducing since my Linux machine doesn't have much space for android-ndk.
Could you please share how can I test it without Gluon? |
When I use |
I am having exactly same issue too, details |
I've created a repo here that demonstrates this issue. You should be able to clone the repo, and run the command specified in the readme, which will compile, link, and package an apk, and then install and run the app on a device connected via adb. The app should install, but when opening it will immediately crash with the error described. |
Tracked internally on GR-31945 |
Hi, I talked to @AlmasB about it and it looks like the code works on GraalVM 20.2.0 - the error starts appearing from 21.1. On the other hand, 21.1 is required for the new GluonFX maven plugin. |
I was getting this error, but using gluonfx maven plugin version 1.0.3 the error has gone away. The simple reproducer that @robert-picking posted is working now, too. I'm using gluon's build of graalvm (version 21.1, although there is a newer version now based on a pre-release of 21.2: https://github.com/gluonhq/graal/releases/tag/gluon-21.2.0-dev-20210621_1207). |
Thanks for the tip. I updated to gluonfx-maven-plugin 1.0.3, and GraalVM 21.2 (they have just realeased it) but I still get the same error. Same for gluon-21.2.0-dev. But I hope it means we're getting somewhere :) |
You might try the simple example that @robert-picking posted: https://github.com/robert-picking/hellofx-jni-awt-bug If that works, then it sounds like there's an additional bug somewhere. If it doesn't work, then it's possible there's a setup/configuration issue on your end. When I tested it, I was using Ubuntu 20.04. |
@marinier : I have just checked with that example. The bug still occurs. gluon-21.2.0-dev, gluonfx-maven-plugin 1.0.3. I'm on Linux Mint 20.1, but I don't think that's the issue here. |
I just checked, and my java version is graalvm-svm-linux-gluon-21.1.0-dev, dated 4-20-2021. I think the fix is actually in gluon's substrate, which should be part of the gluonfx plugin. (If you look at the commits to the gluonfx maven plugin, many of them are updating the substrate version.) I wonder if it's somehow picking up a different substrate version from the classpath? Like graalvm's? |
I obviously just stumbled over the same error. Is there any fix or news in sight? |
I just tried running @robert-picking's reproducer again and I'm now getting the awt error :( Not sure why it worked for me before. In my own application, there is a part that didn't work before that works now, but another part that still fails related to apache configuration2 (which is what the reproducer checks). |
I am not using that apache library but still get this error. |
It's not specific to that library. When we investigated before, it seemed like it might be related to code that uses classes from the java.desktop module (but not all classes). Apache configuration uses beans, which are in that module. |
I am working on a pure JavaFX example right at the moment. I found that something like this should also cause the trouble but I still have to confirm that.
A simple select binding uses the ReadOnlyPropertyDescriptor which then uses the PropertyChangeListener which is in java.desktop. UPDATE: I can't confirm this. In this context the problem does not show up although it uses java.desktop. So, just using java.desktop is not a sufficient condition to trigger the bug. |
I think we ran into issues with PropertyChangeListener too. It seems sufficient to have an entry in the reflect-config.json file -- it doesn't seem to be necessary to actually use it in your code. |
There is a tentative workaround to avoid AWT references on Android, providing AWT is not used explicitly by the project. gluonfx-maven-plugin version: 1.0.4-SNAPSHOT plugin repository:
|
I tried it with @robert-picking's reproducer and it worked (for real this time). |
Another workaround to keep in mind is using |
Describe the issue
When attempting to build, package and install for android, the build and install succeeds, but when the app is launched for the first time it crashes with the error shown below
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_awt" referenced by "/data/app/...-sc5Osp1K9aHqgnWO_iRKQw==/lib/arm64/libsubstrate.so"...
This is not an issue when building for a different platform, as building and running a windows exe works just fine and does not crash on startup.
My initial research turned up this bug report that leads me to believe it might be an issue specific to a linux build environment.
Steps to reproduce the issue
I'm not 100% sure what is causing this issue, my first thought would be that is something related to the build environment (linux) as this is not an issue building the same application on windows. This fatal exception occurs when building on both debian and ubuntu.
Describe GraalVM and your environment:
This is using the gluon maven client plugin to build a native image.
More details
The text was updated successfully, but these errors were encountered: