quarkus: Error while creating the native imgae on mac os

I am running the below command

./mvnw package -Pnative -Dquarkus.native.container-build=true

I am getting following error

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.3.1.Final:build (default) on project my-artifactId: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:353)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:938)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:273)
[ERROR] 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2027)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1551)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1442)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 125
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:369)
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:339)
[ERROR] 	... 12 more

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin Parthiv.local 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
  • Output of java -version:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
  • Quarkus version or git rev: 1.3.1
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 31 (17 by maintainers)

Most upvoted comments

I understand that. What I don’t understand is how I am supposed to increase that value, as any combination of numbers I tried (which all seemed reasonable) had no effect.

I had the same issue and found the solution. Docker memory usage HAS to be configured in 2 places:

  • open “Preferences -> Advanced” in your Docker Desktop and adjust max memory. Mine is 8G
  • add jvm memory arg in pom.xml:
<properties>
    ......
    <quarkus.native.native-image-xmx>8192m</quarkus.native.native-image-xmx>
  </properties>

In fact the jvm args could be configured in other ways, too.

I can confirm this is the solution = Adjust the memory setting too in your Docker Desktop. I didn’t see this suggestion in anywhere for months. Thanks god! Without that, even you set your xmx to 10g it just wont work.

As for the jvm xmx, I’m doing it in command as such mvn clean install -Pnative -Dnative-image.docker-build=true -Dquarkus.native.native-image-xmx=4g

I understand that. What I don’t understand is how I am supposed to increase that value, as any combination of numbers I tried (which all seemed reasonable) had no effect.

I had the same issue and found the solution. Docker memory usage HAS to be configured in 2 places:

  • open “Preferences -> Advanced” in your Docker Desktop and adjust max memory. Mine is 8G
  • add jvm memory arg in pom.xml:
<properties>
    ......
    <quarkus.native.native-image-xmx>8192m</quarkus.native.native-image-xmx>
  </properties>

In fact the jvm args could be configured in other ways, too.

@mutasemhidmi make sure to follow the instructions from BigFatDog a few comments above…

I had the same issue, but my Docker Desaktop only had 2gb configured. When I changed its preferences to 8gb I could successfully build the native image with:

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=8g

I have never even used a Mac, so it will be difficult for me take it 😃

lol me neither. Linux since 20 years! Ok let’s ask to our other teammates then.

Hm… I see [ERROR] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Unable to get GraalVM version from the native-image binary. in the logs.

Can you please try and execute the following command:

docker run --rm quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11 --version

?