ByerN / libgdx-graalvm-example

Advanced LibGDX demo with GraalVM native-image configuration
28 stars 2 forks source link

Fatal error:java.lang.NoSuchMethodError: OptionDescriptor.create #1

Open mtalijanac opened 2 years ago

mtalijanac commented 2 years ago

I have tried to follow compilation steps described in readme.md but I always end up with GraalVM error. I am able to build fat desktop.jar and run it successfully with run_with_agent.bat. I don't see graalvm classes within generated config files. My environment is:

The error happens while runing build_native.bat:

$ native-image.cmd -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime --initialize-at-run-time=org.lwjgl --no-fallback --allow-incomplete-classpath -H:ReflectionConfigurationFiles=config/reflect-config.json -H:JNIConfigurationFiles=config/jni-config.json -H:DynamicProxyConfigurationFiles=config/proxy-config.json -H:SerializationConfigurationFiles=config/serialization-config.json -H:ResourceConfigurationFiles=config/resource-config.json -Dorg.lwjgl.librarypath=. -ja

Fatal error:java.lang.NoSuchMethodError: 'org.graalvm.compiler.options.OptionDescriptor org.graalvm.compiler.options.OptionDescriptor.create(java.lang.String, org.graalvm.compiler.options.OptionType, java.lang.Class, java.lang.String, java.lang.Class, java.lang.String, org.graalvm.compiler.options.OptionKey, boolean)' at org.graalvm.compiler.loop.LoopPolicies_OptionDescriptors.get(LoopPolicies_OptionDescriptors.java:17) at org.graalvm.compiler.loop.LoopPolicies_OptionDescriptors$1.next(LoopPolicies_OptionDescriptors.java:43) at org.graalvm.compiler.loop.LoopPolicies_OptionDescriptors$1.next(LoopPolicies_OptionDescriptors.java:34) at com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:76) at com.oracle.svm.hosted.option.HostedOptionParser.(HostedOptionParser.java:60) at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:277) at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569) at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122) at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599) [total]: 4,388.08 ms, 0.96 GB Error: Image build request failed with exit status 1

ByerN commented 2 years ago

I was testing on: graalvm-ce-java11-21.0.0.2 Could you change the version to one you are using in https://github.com/ByerN/libgdx-graalvm-example/blob/master/build.gradle and let me know if it solved the problem? If so I will add a solution to README.

mtalijanac commented 2 years ago

I have managed to build exe file using:

But the exe won't run as it is missing dlls in path. So I have copied following x64 dlls from fat-jar to a root of graalvm-env folder:

Now with those dlls in place application starts, some loging happens, basic window is drawn, but than it closes immediately without any error being thrown. I presume opengl initialization goes wrong but I do not known anything about OpenGL, GraalVM or libgdx. It's strange as app works perfectly fine when run on GraalVM java. Aynway I have uploaded binary files, if you could take a look.

The exact versions of tools used for this build were:

I have built libgdx-contribs-postprocessing dependency myself as it is not present on maven central.

mtalijanac commented 2 years ago

In order to exclude driver related problems I have tried to run this binary on multiple computers using diferent gpus. But it behaves the same: