-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
macOS: no awt in java.library.path #4124
Comments
You can follow instructions here in the meantime to use docker to build it and run it, and do a port forwarding so you can still access from the mac and continue development while this gets fixed. https://github.com/Karm/quarkus-quickstarts/blob/quarkus-awt/awt-graphics-rest-quickstart/src/main/docker/Dockerfile.native |
I tried to compile a jetbrain compose app on Mac using the latest build
|
@pejovica did the AWT for Windows so he can give a better estimate. |
Is there any GraalVM-compatible way to read the clipboard on macOS since I cannot use |
I am also experiencing this issue, and I hope it can be fixed |
@pejovica One tricky problem with supporting AWT on Mac is that Cocoa requires the event loop (RunLoop in their lingo) to be started on the main thread. So JDK's libjli (Java Launch Interface) spawns another thread right away and runs JVM there, while parking the original thread in the run loop, i.e. does something like the following:
I ported this logic to SVM some time ago. The result was a change to JavaMainWrapper which worked but was rather hack-like. If you are interested I can put up a PR with my changes for reference. |
I also hit this issue today and would love to see it fixed. Do we have any rough idea of timings as to when it might be? Many thanks.. |
Were also experiencing this issue, hope this can be fixed soon. |
Seeing this with 22.1.0 |
this issue still exists in the latest version. in windows already resolved, right? |
A major problem is that the whole AWT classes are missing. Even code which just needs some AWT classes, e.g., BufferedImage to do some offline image processing, can't be compiled with native-image. Such class usage is completely independent from the threading problem cited here. Even offline rendering into an image should not be affected as far as I know. But this is all impossible because the classes are just missing in the Mac. |
@mipastgt indeed, i think i hit this by using |
@mipastgt Exactly this. I was trying to compile a code that modifies and re-exports PDFs, requiring |
That are exactly the problems that I had in mind. Many software makes use of AWT classes without actually trying to run an AWT application and thus cannot be compiled on the Mac. |
FYI, Graalvm team recently announced its Community Roadmap. In its Native +Compiler tab, there's one ticket for improved AWT support, though unfortunately it's not prioritized for upcoming releases just yet. As previously discussed, some of the classes in |
Bellsoft is providing that support already now. |
@mipastgt They have no download option for ARM (M1) though... Hope to see this resolved soon 🙂 |
They do have ARM support already. Have a look here: https://bell-sw.com/pages/downloads/native-image-kit/#/nik-22-17 There are tabs for x86 and arm. |
@mipastgt You're absolutely right, don't know how I missed that. Must've been looking at the NIK 21 downloads. |
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
- This is a workaround until oracle/graal#4124 is fixed
Still present in latest dev version of OpenJDK/LabJDK+GraalVM which does include a similar patch for linux (graalvm#487 (comment)) - I'm posting this so that debugging is easier for you. |
I am seeing this on iOS as well on latest community edition of graalvm. |
I just wanted to compile to native image a simple Swing application, so I followed https://www.graalvm.org/22.2/reference-manual/native-image/guides/use-native-image-maven-plugin/ guide and hit the exact same issue:
with:
Basically it seems it's impossible to get any Swing app compiled to native image as it heavily relies on |
Same issue with java 21 (graalvm edition), spring boot 3 and Gradle :( |
After trying several Graals I was glad I stumbled upon this thread. I can confirm that the Bellsoft Liberica NIK 23..1.1 (OpenJDK 21) works for me (creating ASCIIArt). |
I've tried using Bellsoft Liberica NIK on MacOS ARM, and it worked fine. |
I'm just curious, I know that Bellsoft is a paid offering. Roughly how much does it cost, and how do they bill? Per end CPU? Per native build? Something else? Thanks. |
Bellsoft Liberica NIK can be used freely. You only have to pay if you want support for it. https://bell-sw.com/support/#pricing |
Oh, that's great to hear. Thanks for the quick reply! I have been blocked using vanilla Graal for a while and now will give Bellsoft a spin to see if it gets me unblocked. I'm assuming the metadata I recorded earlier via Graal works for the latter as well. (Reflection, JNI usage, etc.). |
the bell-sw's native-image is working! |
They did not rewrite it but added some missing parts and provide their own modified build of native-image and the supporting libs. |
For me it is not, I'm using the last version Liberika 21.0.2, 23.1.2.r21-nik
|
Fixed json payload for Windows, linux and MAc. Fixed doc generation for Windows and Linux. However, this solution is currently not supported on MacOS. This is due to the lack of support for 'AWT' in GraalVM Native Images on MacOS, as explained in this GitHub issue: oracle/graal#4124. We are working on providing support for MacOS in the future.
Dear graalvm team, do you have any updates/plans regarding this issue? Thanks for letting us know. |
By analysing the reports it looks like Bellsoft are linking awt statically. Why can't the graalvm team use a similar approach as Bellsoft? at least for now just to unblock a lot of users. |
ERROR: java.lang.UnsatisfiedLinkError: no awt in java.library.path
when attempting to build a native image that depends on AWT on macOS.Original issue reported at #2842
The parent issue has been resolved for both windows and linux but remains on macOS. Per @vjovanov, I'm creating a separate report to track this issue specifically for macOS since the parent issue has been closed.
The text was updated successfully, but these errors were encountered: