Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-3540

Building native binary on arm64/macOS M1 not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Critical Critical
    • 3.8.5.GA
    • 3.2.9.GA, 3.2.6.CR2
    • team/eng
    • False
    • None
    • False
    • Hide
      git clone git@github.com:quarkusio/quarkus-super-heroes.git
      cd quarkus-super-heroes
      git checkout rhbq-3.8
      cd rest-fights
      ./mvnw -B clean package -DskipTests -Pnative -Dquarkus.http.host=0.0.0.0 -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=registry.redhat.io/quarkus/mandrel-for-jdk-21-rhel8:23.1 -Dquarkus.native.container-runtime-options=--platform=linux/arm64 -Dquarkus.container-image.build=true
      
      Show
      git clone git@github.com:quarkusio/quarkus-super-heroes.git cd quarkus-super-heroes git checkout rhbq-3.8 cd rest-fights ./mvnw -B clean package -DskipTests -Pnative -Dquarkus.http.host=0.0.0.0 -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=registry.redhat.io/quarkus/mandrel- for -jdk-21-rhel8:23.1 -Dquarkus.native.container-runtime-options=--platform=linux/arm64 -Dquarkus.container-image.build=true
    • ---
    • Red Hat build of Quarkus

      I know we don't "officially" support native on arm, but I'm running across an issue trying to build a native arm container image with RHBQ 3.2 that I don't get with community 3.2, so something in RHBQ 3.2 is causing this issue which is not present in community 3.2. https://github.com/quarkusio/quarkus-super-heroes/actions/runs/6587160651/job/17896883175 shows the same build running successfully with the same builder image with community Quarkus 3.2.7.
       
      This is using the builder image 

      quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-java17

       

      Full log can be viewed at https://github.com/quarkusio/quarkus-super-heroes/actions/runs/6587918998/job/17899133555

      Source code for the project in question can be found at https://github.com/quarkusio/quarkus-super-heroes/tree/rhbq-3.2/rest-fights
       
      Build command:

      ./mvnw -B clean package -DskipTests -Pnative \
          -Dmaven.compiler.release=17 \
          -Dquarkus.http.host=0.0.0.0 \
          -Dquarkus.native.container-build=true \
          -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-java17 \
          -Dquarkus.native.container-runtime-options=--platform=linux/arm64 \
          -Dquarkus.container-image.build=true \
          -Dquarkus.container-image.push=false \
          -Dquarkus.container-image.tag=native-latest-rhbq-3.2-arm64 \
          -Dquarkus.docker.buildx.platform=linux/arm64 

      Error produced:

      Error: Class specified as onlyWith for io.quarkus.netty.runtime.graal.HttpContentCompressorSubstitutions$ZstdEncoderFactorySubstitution cannot be loaded or instantiated: io.quarkus.netty.runtime.graal.HttpContentCompressorSubstitutions$IsZstdAbsent
      com.oracle.svm.core.util.UserError$UserException: Class specified as onlyWith for io.quarkus.netty.runtime.graal.HttpContentCompressorSubstitutions$ZstdEncoderFactorySubstitution cannot be loaded or instantiated: io.quarkus.netty.runtime.graal.HttpContentCompressorSubstitutions$IsZstdAbsent
          at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1042)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:377)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:355)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:1003)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:888)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:579)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
      Caused by: java.lang.reflect.InvocationTargetException
          at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
          at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
          at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
          at org.graalvm.nativeimage.base/com.oracle.svm.util.ReflectionUtil.newInstance(ReflectionUtil.java:106)
          at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1040)
          ... 10 more
      Caused by: java.lang.UnsatisfiedLinkError: no zstd-jni-1.5.2.3-redhat-00002 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
      Unsupported OS/arch, cannot find /linux/aarch64/libzstd-jni-1.5.2.3-redhat-00002.so or load zstd-jni-1.5.2.3-redhat-00002 from system libraries. Please try building from source the jar or providing libzstd-jni-1.5.2.3-redhat-00002 in your system.
          at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
          at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
          at java.base/java.lang.System.loadLibrary(System.java:1989)
          at com.github.luben.zstd.util.Native.load(Native.java:87)
          at com.github.luben.zstd.util.Native.load(Native.java:55)
          at com.github.luben.zstd.Zstd.<clinit>(Zstd.java:13)
          at java.base/java.lang.Class.forName0(Native Method)
          at java.base/java.lang.Class.forName(Class.java:375)
          at io.quarkus.netty.runtime.graal.HttpContentCompressorSubstitutions$IsZstdAbsent.<init>(HttpContentCompressorSubstitutions.java:38)
          ... 17 more 

              cescoffi@redhat.com Clement Escoffier
              eric.deandrea Eric Deandrea
              Michal Jurc Michal Jurc
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: