Search code examples
micronautgraalvmgraalvm-native-image

Micronaut Cannot Build Native Image Graalvm


I'm trying out the Micronaut Application as a Graalvm native image found here.

But when I'm running the ./gradlew buildNativeLambda I'm having these exception:

Error: Image build request failed with exit status 137
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 137
        at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1772)
        at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1519)
        at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1480)
        at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1467)


> Task :dockerBuildNative FAILED

FAILURE: Build failed with an exception.

Google says it's probably an out of memory exception, but I can't find any example how to solve it. I'm building the sample project from the link without modifying it, but I can't make it work. Am I missing some config for it to work properly? I'm working on Mac with 16g memory.


Solution

  • Your Docker Desktop application (I´m assuming you´re using this) also needs to be configured to be allowed to use enough RAM:

    The provided value is just an example, it might work with much less already.