Native compilation with GraalVM (HE 12.4) / success
Added by Eric Marsden 8 months ago
Hi,
This message to note that the native-image builder in GraalVM is now able to generate a native executable from the v12.4 jar files, at least on Linux. This wasn't possible last time I checked due to a native-image bug.
I used this command (it's also possible to install GraalVM locally, of course):
podman run --rm -v .:/app container-registry.oracle.com/graalvm/native-image:22 native-image -O2 --no-fallback -H:+UnlockExperimentalVMOptions -H:+RemoveUnusedSymbols -H:ReflectionConfigurationFiles=reflection-config.json -cp lib/xmlresolver-5.2.2.jar:lib/xmlresolver-5.2.2-data.jar -jar saxon-he-12.4.jar
The small reflection-config.json is attached. I haven't run any tests but the generated image works for my very basic XSLT needs, with the "-s", "-xsl" and "-o" commandline arguments.
It generates a 42MB executable (linked to glibc) from the 5.4MB jar file for saxon-he-12.4. This compresses to 17M with the upx executable packer.
reflection-config.json (568 Bytes) reflection-config.json |
Replies (5)
Please register to reply
RE: Native compilation with GraalVM (HE 12.4) / success - Added by Martin Honnen 8 months ago
Are you aware of SaxonC https://www.saxonica.com/saxon-c/index.xml ("The latest release is SaxonC 12.4.2, built from SaxonJ 12.4 (using GraalVM Native Image 22.3.1), released 25 January 2024, on Linux, MacOS and Windows.")?
RE: Native compilation with GraalVM (HE 12.4) / success - Added by Eric Marsden 8 months ago
I had misunderstood the licensing situation concerning Saxon-C, and didn't realize that an open source (MPL) version was available for that, thanks for pointing this out.
RE: Native compilation with GraalVM (HE 12.4) / success - Added by Trevor Lawrence 6 months ago
This is good news.
I'm interested in using Saxon-EE from within a GraalVM-built native executable, specifically using the Quarkus framework.
Is there any guidance available on whether that's something that could one day be a supported configuration? Given that there's already Saxon-C releases built by doing more or less the same thing, I would hope so.
RE: Native compilation with GraalVM (HE 12.4) / success - Added by O'Neil Delpratt 6 months ago
Hi,
We don't directly support Quarkus framework with Saxon. I know of projects that have successfully integrated Saxon-EE within Quarkus themselves. Also you may find extensions out there to do what you need. I suggest trying to integrated the SaxonC library produced by Graalvm into the Quarkus framework and let us know how it goes.
RE: Native compilation with GraalVM (HE 12.4) / success - Added by Trevor Lawrence 6 months ago
^ Will do, thank you O'Neil.
Please register to reply