Quarkus: Error when building a Native Image on Fedora 30 (Linux Kernel 5.2.7)

Created on 15 Aug 2019  Â·  11Comments  Â·  Source: quarkusio/quarkus

Describe the bug
When packaging the native image for any project it fails in Fedora 30 with Linux Kernel 5.2.7 with this error:

Error: Error compiling query code (in /tmp/SVM-6611687687789136547/PosixDirectives.c). Compiler command  gcc /tmp/SVM-6611687687789136547/PosixDirectives.c -o /tmp/SVM-6611687687789136547/PosixDirectives output included error: /tmp/SVM-6611687687789136547/PosixDirectives.c:2305:101: error: ‘SIOCGSTAMP’ undeclared (first use in this function); did you mean ‘SIOCGRARP’?
    method com.oracle.svm.core.posix.headers.Socket.SIOCATMARK()

Expected behavior
The native image gets created without errors.

Actual behavior
The native image creation using -Pnative fails with an error, and no native image gets created

To Reproduce
Steps to reproduce the behavior:

  1. Install Fedora 30 and update it
  2. Install GraalVM 19.1.1, create the env variable GRAALVM_HOME
  3. Install OpenJDK 1.8 and Maven 3.5
  4. Create a Quarkus project
  5. Try to package it as a native image

Environment (please complete the following information):

  • Output of uname -a:
Linux workstation.acme.org 5.2.7-200.fc30.x86_64 #1 SMP Thu Aug 8 05:35:29 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version:
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
  • GraalVM version 19.1.1
  • Quarkus version or git rev: 0.20.0

Additional context

$ cat /etc/fedora-release 
Fedora release 30 (Thirty)

$ uname -r
5.2.7-200.fc30.x86_64

$ echo $GRAALVM_HOME 
/opt/graalvm-ce-19.1.1

$ mvn -version
Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Maven home: /usr/share/maven
Java version: 1.8.0_222, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.fc30.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.2.7-200.fc30.x86_64", arch: "amd64", family: "unix"

$ mvn io.quarkus:quarkus-maven-plugin:0.20.0:create \
      -DprojectGroupId=org.acme.example \
      -DprojectArtifactId=getting-started \
      -DclassName="org.acme.quickstart.GreetingResource" \
      -Dpath="/hello"
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:0.20.0:create (default-cli) @ standalone-pom ---
Creating a new project in /var/tmp/quarkus-getting-started/.
Configuration file created in src/main/resources/application.properties
[INFO] 
[INFO] Maven Wrapper version 0.5.5 has been successfully set up for your project.
[INFO] Using Apache Maven: 3.6.1
[INFO] Repo URL in properties file: https://repo.maven.apache.org/maven2
[INFO] 
[INFO] 
[INFO] ========================================================================================
[INFO] Your new application has been created in /var/tmp/quarkus-getting-started/.
[INFO] Navigate into this directory and launch your application with mvn compile quarkus:dev
[INFO] Your application will be accessible on http://localhost:8080
[INFO] ========================================================================================
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.120 s
[INFO] Finished at: 2019-08-14T22:59:18-05:00
[INFO] ------------------------------------------------------------------------

$ mvn clean package -Pnative                
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.acme.example:getting-started >------------------
[INFO] Building getting-started 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ getting-started ---
[INFO] Deleting /var/tmp/quarkus-getting-started/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ getting-started ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/tmp/quarkus-getting-started/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/tmp/quarkus-getting-started/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ getting-started ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /var/tmp/quarkus-getting-started/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ getting-started ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.quickstart.GreetingResourceTest
2019-08-14 23:00:37,176 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-08-14 23:00:37,816 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 640ms
2019-08-14 23:00:38,097 INFO  [io.quarkus] (main) Quarkus 0.20.0 started in 0.279s. Listening on: http://[::]:8081
2019-08-14 23:00:38,098 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.548 s - in org.acme.quickstart.GreetingResourceTest
2019-08-14 23:00:38,999 INFO  [io.quarkus] (main) Quarkus stopped in 0.005s
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ getting-started ---
[INFO] Building jar: /var/tmp/quarkus-getting-started/target/getting-started-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- quarkus-maven-plugin:0.20.0:build (default) @ getting-started ---
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Beginning quarkus augmentation
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Beta5
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 919ms
[INFO] [io.quarkus.creator.phase.runnerjar.RunnerJarPhase] Building jar: /var/tmp/quarkus-getting-started/target/getting-started-1.0-SNAPSHOT-runner.jar
[INFO] 
[INFO] --- quarkus-maven-plugin:0.20.0:native-image (default) @ getting-started ---
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] Running Quarkus native-image plugin on OpenJDK 64-Bit Server VM
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /opt/graalvm-ce-19.1.1/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar getting-started-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:-SpawnIsolates -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[getting-started-1.0-SNAPSHOT-runner:1894]    classlist:   2,778.34 ms
[getting-started-1.0-SNAPSHOT-runner:1894]        (cap):     414.57 ms
[getting-started-1.0-SNAPSHOT-runner:1894]        setup:     733.39 ms
Error: Error compiling query code (in /tmp/SVM-6611687687789136547/PosixDirectives.c). Compiler command  gcc /tmp/SVM-6611687687789136547/PosixDirectives.c -o /tmp/SVM-6611687687789136547/PosixDirectives output included error: /tmp/SVM-6611687687789136547/PosixDirectives.c:2305:101: error: ‘SIOCGSTAMP’ undeclared (first use in this function); did you mean ‘SIOCGRARP’?
    method com.oracle.svm.core.posix.headers.Socket.SIOCATMARK()
    C file contents around line 2305:
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2304:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCATMARK:PropertyInfo:value=%lX\n", SIOCATMARK);
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2305:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCGSTAMP:PropertyInfo:size=%lu\n", sizeof(SIOCGSTAMP));
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2306:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCGSTAMP:PropertyInfo:signedness=$%s$\n", (IS_CONST_UNSIGNED(SIOCGSTAMP)) ? "UNSIGNED" : "SIGNED");
com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in /tmp/SVM-6611687687789136547/PosixDirectives.c). Compiler command  gcc /tmp/SVM-6611687687789136547/PosixDirectives.c -o /tmp/SVM-6611687687789136547/PosixDirectives output included error: /tmp/SVM-6611687687789136547/PosixDirectives.c:2305:101: error: ‘SIOCGSTAMP’ undeclared (first use in this function); did you mean ‘SIOCGRARP’?
    method com.oracle.svm.core.posix.headers.Socket.SIOCATMARK()
    C file contents around line 2305:
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2304:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCATMARK:PropertyInfo:value=%lX\n", SIOCATMARK);
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2305:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCGSTAMP:PropertyInfo:size=%lu\n", sizeof(SIOCGSTAMP));
    /tmp/SVM-6611687687789136547/PosixDirectives.c:2306:     printf("NativeCodeInfo:PosixDirectives:ConstantInfo:SIOCGSTAMP:PropertyInfo:signedness=$%s$\n", (IS_CONST_UNSIGNED(SIOCGSTAMP)) ? "UNSIGNED" : "SIGNED");
    at com.oracle.svm.core.util.UserError.abort(UserError.java:114)
    at com.oracle.svm.hosted.c.NativeLibraries.reportErrors(NativeLibraries.java:196)
    at com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeImageGenerator.java:1512)
    at com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(NativeImageGenerator.java:993)
    at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:827)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:520)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:440)
    at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.790 s
[INFO] Finished at: 2019-08-14T23:00:44-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.20.0:native-image (default) on project getting-started: Failed to generate a native image: Failed to build native image: Image generation failed -> [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
kinbug

All 11 comments

linux-headers-5.2 and proper use of SIOCGSTAMP:

https://lkml.org/lkml/2019/7/20/108

I found a similar issue:

Error: Error compiling query code (in /tmp/SVM-772838697049441671/PosixDirectives.c). Compiler command gcc /tmp/SVM-772838697049441671/PosixDirectives.c -o /tmp/SVM-772838697049441671/PosixDirectives output included error: /tmp/SVM-772838697049441671/PosixDirectives.c:942:101: error: ‘SIOCGSTAMP’ undeclared (first use in this function); did you mean ‘SIOCGRARP’?

My environment is:

  • Kernel: 5.2.8-200.fc30.x86_64
  • GraalVM: 19.2.0
  • JDK: openjdk version "1.8.0_222" and openjdk version "11.0.4" 2019-07-16

I confirm, built with the fix for https://github.com/oracle/graal/issues/1582 and it solves this problem.

@Sanne do you know when a new Graal release with the fix will be released?

do you know when a new Graal release with the fix will be released?

No I don't know. No big deal for me, I'm running a locally built snapshot now and Quarkus seems fine

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-20190711120915.buildslave.jdk8u-src-tar--b08)
OpenJDK 64-Bit GraalVM 19.3.0-dev (build 25.222-b08-jvmci-19.3-b01, mixed mode)

Still, annoying for all our users on Fedora.

Actually what concerns me more is that I sometimes need to run an old GraalVM version to verify something: reports/regressions, etc.. I will need to build each of those each time, as this recent Fedora upgrade broke all older versions too.

This is probably affecting a lot of developers on Fedora (it's affecting me)... other than building my own GraalVM with the patch, what are the other workarounds?

Any idea when the new release of GraalVM with this fix will be released?

4013 will fix this

https://github.com/quarkusio/quarkus/pull/4043 was merged, this issue can be closed

Was this page helpful?
0 / 5 - 0 ratings