oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
19.96k stars 1.6k forks source link

Native image fails to build inside Docker container on Mac with Apple Silicon using GraalVM CE 22.3.0 #9208

Open muttbag opened 3 days ago

muttbag commented 3 days ago

Describe the issue GraalVM CE 22.3.0 will fail to build a native image when executed inside a Docker container and the host machine uses Apple Silicon.

Steps to reproduce the issue Please include both build steps as well as run steps

  1. git clone https://github.com/muttbag/graalvm.git
  2. docker build . -t docker-graalvm-image
  3. docker run --platform=linux/amd64 --volume $(pwd):/tmp --rm -it docker-graalvm-image /bin/bash
  4. cd /tmp
  5. mvn clean package -Pnative -DskipTests=true

Describe GraalVM and your environment:

More details Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.

Stack trace

    [INFO] Executing: /usr/lib/graalvm/bin/native-image -cp /tmp/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter/3.3.1/spring-boot-starter-3.3.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar:/root/.m2/repository/org/springframework/spring-context/6.1.10/spring-context-6.1.10.jar:/root/.m2/repository/org/springframework/spring-aop/6.1.10/spring-aop-6.1.10.jar:/root/.m2/repository/org/springframework/spring-beans/6.1.10/spring-beans-6.1.10.jar:/root/.m2/repository/org/springframework/spring-expression/6.1.10/spring-expression-6.1.10.jar:/root/.m2/repository/io/micrometer/micrometer-observation/1.13.1/micrometer-observation-1.13.1.jar:/root/.m2/repository/io/micrometer/micrometer-commons/1.13.1/micrometer-commons-1.13.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.3.1/spring-boot-autoconfigure-3.3.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/3.3.1/spring-boot-starter-logging-3.3.1.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.5.6/logback-classic-1.5.6.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.5.6/logback-core-1.5.6.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.23.1/log4j-to-slf4j-2.23.1.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.23.1/log4j-api-2.23.1.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/2.0.13/jul-to-slf4j-2.0.13.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/root/.m2/repository/org/springframework/spring-core/6.1.10/spring-core-6.1.10.jar:/root/.m2/repository/org/springframework/spring-jcl/6.1.10/spring-jcl-6.1.10.jar:/root/.m2/repository/org/yaml/snakeyaml/2.2/snakeyaml-2.2.jar:/root/.m2/repository/org/slf4j/slf4j-api/2.0.13/slf4j-api-2.0.13.jar --no-fallback -o /tmp/target/demo -H:ConfigurationFileDirectories=/tmp/target/graalvm-reachability-metadata/6aa5bb9d1d343542e1769dd6d9092269b186771/ch.qos.logback/logback-classic/1.4.9
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007fffe70b807a, pid=240, tid=259
    #
    # JRE version: OpenJDK Runtime Environment GraalVM CE 22.3.0 (17.0.5+8) (build 17.0.5+8-jvmci-22.3-b08)
    # Java VM: OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (17.0.5+8-jvmci-22.3-b08, mixed mode, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
    # Problematic frame:
    # J 2364% jvmci java.util.concurrent.ConcurrentHashMap.transfer([Ljava/util/concurrent/ConcurrentHashMap$Node;[Ljava/util/concurrent/ConcurrentHashMap$Node;)V java.base@17.0.5 (849 bytes) @ 0x00007fffe70b807a [0x00007fffe70b7c20+0x000000000000045a]
    #
    # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
    #
    # An error report file with more information is saved as:
    # /tmp/hs_err_pid240.log
    #
    # If you would like to submit a bug report, please visit:
    #   https://github.com/oracle/graal/issues
    #
    Error: Image build request failed with exit status 134
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  40.570 s
    [INFO] Finished at: 2024-06-27T12:52:51Z
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.10.2:compile-no-fork (build-native) on project demo: Execution of /usr/lib/graalvm/bin/native-image -cp /tmp/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter/3.3.1/spring-boot-starter-3.3.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot/3.3.1/spring-boot-3.3.1.jar:/root/.m2/repository/org/springframework/spring-context/6.1.10/spring-context-6.1.10.jar:/root/.m2/repository/org/springframework/spring-aop/6.1.10/spring-aop-6.1.10.jar:/root/.m2/repository/org/springframework/spring-beans/6.1.10/spring-beans-6.1.10.jar:/root/.m2/repository/org/springframework/spring-expression/6.1.10/spring-expression-6.1.10.jar:/root/.m2/repository/io/micrometer/micrometer-observation/1.13.1/micrometer-observation-1.13.1.jar:/root/.m2/repository/io/micrometer/micrometer-commons/1.13.1/micrometer-commons-1.13.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.3.1/spring-boot-autoconfigure-3.3.1.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/3.3.1/spring-boot-starter-logging-3.3.1.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.5.6/logback-classic-1.5.6.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.5.6/logback-core-1.5.6.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.23.1/log4j-to-slf4j-2.23.1.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.23.1/log4j-api-2.23.1.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/2.0.13/jul-to-slf4j-2.0.13.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/root/.m2/repository/org/springframework/spring-core/6.1.10/spring-core-6.1.10.jar:/root/.m2/repository/org/springframework/spring-jcl/6.1.10/spring-jcl-6.1.10.jar:/root/.m2/repository/org/yaml/snakeyaml/2.2/snakeyaml-2.2.jar:/root/.m2/repository/org/slf4j/slf4j-api/2.0.13/slf4j-api-2.0.13.jar --no-fallback -o /tmp/target/demo -H:ConfigurationFileDirectories=/tmp/target/graalvm-reachability-metadata/6aa5bb9d1d343542e1769dd6d9092269b186771/ch.qos.logback/logback-classic/1.4.9 returned non-zero result -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

hs_err_pid240.log - https://pastebin.com/hyTpNX11

fernando-valdez commented 3 days ago

Hello @muttbag, GraalVM 22.3.0 is a very old version of GraalVM and it is no longer supported. Please upgrade to the latest version available and share if the error continues.