-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cannot open (null)/lib/libjawt.dylib #14
Comments
Hi Michael! Could you provide the means to reproduce this issue? |
The project can be found here: https://github.com/mipastgt/JavaForumStuttgartTalk2022/tree/main/PolySpiralMpp Thanks for looking into this! |
If this upload works you can skip building the project and just use the jar here: |
Hi Michael, thank you for reporting this. We'll take a look |
The "Cannot open (null)/lib/libjawt.dylib: dlopen((null)/lib/libjawt.dylib" exception is reported by https://github.com/JetBrains/skiko library. It uses "java.home" to create a path to jawt lib and dlopen to dynamically access native JAWT_GetAWT method: I checked the way where JAWT_GetAWT is called directly from Skiko_GetAWT method (Toolkit.getDefaultToolkit() is called before from java to initialize awt stuff):
and add jawt dependency to skiko shared lib:
It works when I run SkiaAwtSample with java on my Linux desktop (should work on MacOS as well, though the path to lib may need to be updated on Windows). But running a native image for SkiaAwtSample with these changes fails with exception that System.load("skiko-...") method from Library.loadLibraryOrCopy() method is unable to load skiko library because it depends on jawt.
I will try to look the other ways which could help to properly use JAWT_GetAWT native method with GraalVM in skiko library. |
The solution to use JAWT_GetAWT native method with GraalVM could be linking the skiko library with static jawt lib. Example:
JAWTExample.c
Link static jawt library:
The libJAWTExample.so does not have dependencies to jawt lib:
JAWT_GetAWT symbol is included into the JAWTExample shared library:
Make a native image:
To run the native image it needs to pass -Djava.library.path=. parameter:
I believe it should work for skiko library as well. |
I created a request to update skiko lib so it would be possible to use it with GraalVM. JetBrains/skiko#580 |
Thanks. I subscribed to the new issue too. Let's see what happens. |
I tried the latest Liberica NIK according to this announcement:
https://bell-sw.com/announcements/2022/08/05/liberica-native-image-kit-22-2-0-and-21-3-3-builds-are-out/
I installed the software on macOS 12.5 and verified that the given SwingSet2 demo worked like advertised.
Then I tried to do exactly the same with an application of my own which is a Jetbrains Compose desktop app but Compose also uses AWT for the windowing, so this should work. Building the software works like before without any error but when I try to run my application I only get this:
Cannot open (null)/lib/libjawt.dylib: dlopen((null)/lib/libjawt.dylib, 0x0009): tried: '(null)/lib/libjawt.dylib' (no such file)
It seems as if some path element is undefined (null) but I have no clue why. If there is no obvious solution to this problem and you are willing to have a look at it I could provide the full demo project and all build steps to reproduce the problem.
The text was updated successfully, but these errors were encountered: