Skip to content

ian-p-johnson/graalvm_gradle

Repository files navigation

GraalVM Native - Gradle

Hello from NATIVE Vert.x!

  • ./gradlew clean nativeCompile
  • ./build/native/nativeCompile/graalvm_gradle
    Hello world!
  • task "jar" will also create a fat jar
    java -jar build/libs/graalvm_gradle-1.0-SNAPSHOT.jar
    java -cp build/libs/graalvm_gradle-1.0-SNAPSHOT.jar io.vertx.core.Launcher run org.example.MainVerticle

Added bucketloads of, and ...dependencies

From https://www.graalvm.org/22.2/reference-manual/native-image/guides/build-with-reflection/

  • mkdir -p META-INF/native-image

  • $JAVA_HOME/bin/java -cp build/libs/graalvm_gradle-1.0-SNAPSHOT.jar -agentlib:native-image-agent=config-output-dir=META-INF/native-image io.vertx.core.Launcher run org.example.MainVerticle

  • Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.orjni-config.jsonacle.graal.pointsto.constraints.UnsupportedFeatureException:
    No instances of io.netty.util.internal.logging.Log4J2Logger are allowed in the image heap as this class should be initialized at image runtime.
    To see how this object got instantiated use

    • --trace-oge bject-instantiation=io.netty.util.internal.logging.Log4J2Logger.

Fixed by pushing ALL of netty into runtime initialization

graalvmNative {
    binaries {
        main {
            buildArgs.add('--initialize-at-run-time=io.netty')
        }
    }
}
  • Disabled log4j
    • //implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.20.0'
  • Ran profiling to generate reflect-config.json (in META-INF subtree)

There be monsters below - you don't need to go any farther:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages