Closed mmoayyed closed 11 months ago
i was not able to get the project running, can you please share a minimal reproducer
@mmoayyed can you check if you have this dependency implementation("org.graalvm.polyglot:polyglot:23.1.1")
you can check this demo on how to run gradle with jdk 21 https://github.com/graalvm/polyglot-embedding-demo
Thank you.
Yes that dependency does exist, and certainly, the project does compile fine with GraalVM SDK available on the compile classpath. It's only when the native image actually launches that the error does show up. At the moment, I have removed all such references (i.e. org.graalvm.home.Version
) from the codebase and the project builds and runs OK but I would like to solve this nonetheless.
Looking at the sample demo, I see that there is:
implementation("org.graalvm.polyglot:polyglot:$graalVMVersion")
My understanding was that such libraries must never be actually included in the final native image. As notes here,
The native image "compile only" configurations can typically be used to declare dependencies which are only required when building a native binary, and therefore shouldn’t leak to the classic "JVM" runtime.
Is this not true, or am I misunderstanding this?
@mmoayyed
Before Graalvm for jdk 21 The org.graalvm.polyglot
module was contained by default in the GraalVM JDK.
Starting from GraalVM for jdk 21, To continue using the GraalVM language runtime(s) and other components, use language standalones or specify them as Maven or Gradle dependencies in your project.
see
https://www.graalvm.org/release-notes/JDK_21/ && https://www.graalvm.org/release-notes/JDK_21/#polyglot-embedding
Thank you very much. Defining org.graalvm.polyglot
as a Gradle dependency does indeed help.
Describe the issue
Unable to use GraalVM SDK APIs when native image runs. For example, I see:
Note that the native image builds and compiles OK. The offending class simply does this:
Steps to reproduce the issue
Describe GraalVM and your environment:
More details