Skip to content
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

Native Image with awt can't properly load library #3807

Closed
smallshen opened this issue Sep 17, 2021 · 12 comments
Closed

Native Image with awt can't properly load library #3807

smallshen opened this issue Sep 17, 2021 · 12 comments

Comments

@smallshen
Copy link

Reproducer:
#3342 (comment)
https://github.com/oracle/graal/files/6462384/JetpackComposeMinimumExample.zip

Issue:
After compile it and run the executable, it prints

Cannot open (null)\bin\jawt.dll

and quit.

@smallshen
Copy link
Author

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment GraalVM CE 21.3.0-dev (build 11.0.12+5-jvmci-21.3-b02)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0-dev (build 11.0.12+5-jvmci-21.3-b02, mixed mode, sharing)

Windows 11

@DaniruKun
Copy link

Have the same issue on Darwin :

Using graalvm-ce-java11@21.1.0

Call path from entry point to clojure.core.server$io_prepl$fn__8955.invoke(Object):
	at clojure.core.server$io_prepl$fn__8955.invoke(server.clj:284)
	at clojure.tools.logging.proxy$java.io.ByteArrayOutputStream$ff19274a.flush(Unknown Source)
	at java.io.PrintStream.flush(PrintStream.java:417)
	at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:782)
	at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Original exception that caused the problem: org.graalvm.compiler.core.common.PermanentBailoutException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,41,_,_,_,_] stack: [44] locks: [] rethrowException]
Other frame state: [locals: [1,2,41,_,_,_,_] stack: [74] locks: [51 / 42] rethrowException]
Parser context: clojure.core.server$io_prepl$fn__8955.invoke(server.clj:287) [bci: 84, intrinsic: false]
  84: dup_x2
  85: if_acmpeq     92
  88: pop
  89: goto          114
  92: swap
  93: pop
  94: dup

	at jdk.internal.vm.compiler/org.graalvm.compiler.java.FrameStateBuilder.checkCompatibleWith(FrameStateBuilder.java:415)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.FrameStateBuilder.merge(FrameStateBuilder.java:428)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.createTarget(BytecodeParser.java:3200)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.appendGoto(BytecodeParser.java:3373)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.createExceptionDispatch(BytecodeParser.java:3323)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3256)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1125)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1019)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:76)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:113)
	at com.oracle.svm.hosted.SVMHost.parseBytecode(SVMHost.java:647)
	at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:592)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:304)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:313)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:302)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
	at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:227)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:547)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

@smallshen
Copy link
Author

For me I can successfully build the native binary, but the executable output is the

Cannot open (null)\bin\jawt.dll

@munishchouhan munishchouhan self-assigned this Sep 21, 2021
@munishchouhan
Copy link
Contributor

@smallshen thanks for reporting the issue, we will check it out and get back to you

@munishchouhan
Copy link
Contributor

@smallshen please share the commands you used to generate native-image for https://github.com/oracle/graal/files/6462384/JetpackComposeMinimumExample.zip

@smallshen
Copy link
Author

I use the agent to produce config first, and then
native-image.cmd -jar Jarfile.jar
since the old bug is fixed, It should be able to compile it properly without fallback.

@munishchouhan
Copy link
Contributor

@smallshen while running set java.home property to GRAALVM_HOME to your application
app.exe -Djava.home=$GRAALVM_HOME

@smallshen
Copy link
Author

@mcraj017 thanks it solves the problem, looks like it forget to link the jawt.dll somehow

@smallshen
Copy link
Author

it will load the "bin/jawt.dll" under java.home, is it possible to link it into the exe? same as the java.dll and jvm.dll

@munishchouhan
Copy link
Contributor

@smallshen AWT support on windows for native-image is still in progress
#3084
I will add your comment in the main ticket, so that it will be covered under that effort.

@munishchouhan
Copy link
Contributor

Comment added
#3084 (comment)

@iceBear67
Copy link

The same problem under Linux, but -Djava.home=$JAVA_HOME or $GRAALVM_HOME doesn't work for me.

Cannot open (null)/lib/libjawt.so: (null)/lib/libjawt.so: cannot open shared object file: No such file or directory
[1]    76852 IOT instruction (core dumped)  ./demo

GraalVM CE 22.3.0 (build 11.0.17+8-jvmci-22.3-b08)

Reproducer & artifact: https://transfer.sh/%28/OGIqlm/demo-linux-x64-1.0.0.jar%29.zip

fallback images work correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants