Project

Profile

Help

Native compilation with GraalVM (HE 12.4) / success

Added by Eric Marsden 28 days 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.


Replies (2)

RE: Native compilation with GraalVM (HE 12.4) / success - Added by Martin Honnen 28 days 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 28 days 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.

    (1-2/2)

    Please register to reply