question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graalvm native Compile Error

See original GitHub issue

Describe the bug

Graalvm native compile error after upgrading to 2.5.0.Final, 2.4.1.Final is ok.

[qunar-wh-policy-sync-bin:1603]    classlist:   2,945.80 ms,  0.96 GB
[qunar-wh-policy-sync-bin:1603]        (cap):   1,630.65 ms,  0.96 GB
[qunar-wh-policy-sync-bin:1603]        setup:   3,156.07 ms,  0.96 GB
16:09:03,286 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final
[qunar-wh-policy-sync-bin:1603]     (clinit):   1,317.19 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]   (typeflow):   8,025.14 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]    (objects):  36,579.45 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]   (features):  15,439.03 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]     analysis:  64,534.34 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]     universe:   3,537.22 ms,  5.88 GB
[qunar-wh-policy-sync-bin:1603]      (parse):  12,050.41 ms,  5.56 GB
[qunar-wh-policy-sync-bin:1603]     (inline):  20,814.87 ms,  6.39 GB
[qunar-wh-policy-sync-bin:1603]    (compile):  44,066.67 ms,  6.33 GB
[qunar-wh-policy-sync-bin:1603]      compile:  81,027.26 ms,  6.33 GB
[qunar-wh-policy-sync-bin:1603]        image:   5,066.49 ms,  6.33 GB
[qunar-wh-policy-sync-bin:1603]        write:   1,223.43 ms,  6.33 GB
Fatal error:java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Based on the linker command output, possible reasons for this include:
1. It appears as though libfreetype.a is missing. Please install it.

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-16506476398039308040/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /mnt/d/IdeaProjects/zlzl/ota-q
unar-policy/qunar-wh-policy-sync/target/qunar-wh-policy-sync-native-image-source-jar/qunar-wh-policy-sync-bin qunar-wh-policy-sync-bin.o /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/
static/linux-amd64/glibc/libnet.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libjavajpeg.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd6
4/glibc/libextnet.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libnio.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64/liblibche
lper.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libjava.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/liblcms.a /mnt/d/Java/g
raalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libfontmanager.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /mnt/d/Java/graalv
m-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libawt.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /mnt/d/Java/graalvm-ce-java17-linux-2
1.3.0/lib/static/linux-amd64/glibc/libzip.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-16506476398039308040 -L/mnt/d/Java/graalvm-
ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc -L/mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lfreetype -lpthread -ldl -lz -lrt -no-pie

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortr
an,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --
without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=ne
w --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --d
isable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9
.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/..
/lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/mnt/d/IdeaProjects/zlzl/ota-qunar-policy/qunar-wh-policy-sync/target/qunar-wh-policy-sync-native-image-source-jar/qunar-wh-policy-sync-bin
' '-v' '-L/tmp/SVM-16506476398039308040' '-L/mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc' '-L/mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/li
nux-amd64' '-no-pie' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp
/cc5yzrm1.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-
id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o /mnt/d/IdeaProjects/zlzl/ota-qunar-policy/qunar-wh-policy-sync/targ
et/qunar-wh-policy-sync-native-image-source-jar/qunar-wh-policy-sync-bin -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/9
/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o -L/tmp/SVM-16506476398039308040 -L/mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc -
L/mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/
x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. --gc-sections --dynami
c-list /tmp/SVM-16506476398039308040/exported_symbols.list --exclude-libs ALL -x qunar-wh-policy-sync-bin.o /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libn
et.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libjavajpeg.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libextnet.a /mnt/d/Ja
va/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libnio.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64/liblibchelper.a /mnt/d/Java/graalvm-ce
-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libjava.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/liblcms.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0
/lib/static/linux-amd64/glibc/libfontmanager.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libawt_headless.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/
static/linux-amd64/glibc/libawt.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/glibc/libfdlibm.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/static/linux-amd64/
glibc/libzip.a /mnt/d/Java/graalvm-ce-java17-linux-21.3.0/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lfreetype -lpthread -ldl -lz -lrt -lgcc --push-state --as-needed -lgcc_s
 --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lfreetype
collect2: error: ld returned 1 exit status
        at com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:502)
        at com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:449)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:657)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
[qunar-wh-policy-sync-bin:1603]      [total]: 162,020.49 ms,  6.33 GB
# Printing build artifacts to: /mnt/d/IdeaProjects/zlzl/ota-qunar-policy/qunar-wh-policy-sync/target/qunar-wh-policy-sync-native-image-source-jar/qunar-wh-policy-sync-bin.build_artifac
ts.txt
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ota-qunar-policy 1.1-SNAPSHOT:
[INFO]
[INFO] ota-qunar-policy ................................... SUCCESS [  0.144 s]
[INFO] qunar-international-policy ......................... SUCCESS [  7.276 s]
[INFO] qunar-internal-policy .............................. SUCCESS [  4.234 s]
[INFO] qunar-wh-policy-sync ............................... FAILURE [03:02 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:16 min
[INFO] Finished at: 2021-11-26T16:11:24+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.5.0.Final:build (default) on project qunar-wh-policy-sync: Failed to build quarkus application: io.quarkus.builder.Buil
dException: 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:233)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:369)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:213)
[ERROR]         ... 11 more
[ERROR] -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Ubuntu 20.04 64bit

Output of java -version

17

GraalVM version (if different from Java)

21.3.0

Quarkus version or git rev

2.5.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.3

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Karmcommented, Nov 26, 2021

Hello @joggeli34,

I am working on https://github.com/quarkusio/quarkus/pull/20850 (at the moment) that would, among other things, help with this issue. ETA: Soon 😃

The behaviour when I am done will be this:

  • no AWT dependency and issues with libs you might not need
  • if and only if your application hits the graphics libraries at runtime, an error is shown telling you that you have to depend on AWT extension and that you might have to install additional libraries.

An example to illustrate what I mean: You might have a POJO with Image and String attributes. As long as you are POSTing its XML representation containing just the String attribute, the Image attribute is null and all is well. As soon as you POST also some Image data to deserialize, JAXB logs ERROR, asking you to install AWT extension.

To quickly check on what to install in the meantime, take a look at https://github.com/quarkusio/quarkus-quickstarts/tree/development/awt-graphics-rest-quickstart#additional-system-dependencies

1reaction
joggeli34commented, Nov 26, 2021

Probably related to https://github.com/quarkusio/quarkus/issues/21729, where the awt-dependency got included by liquibase which uses jaxb.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix GraalVM Native Image Build Issues - Simply-How.com
1. Introduction 2. Getting started 3. Build-time errors
Read more >
Native Image Compatibility and Optimization Guide - GraalVM
If such objects are reachable at build time, the native image builder fails with an error. For more information, see Class Initialization in...
Read more >
graalvm/native-image - Gitter
When I add the jar and build the native-image, I get a simple error message: Image build request failed with exit status 137....
Read more >
Exception in GraalVM 22.2 native-image on Ubuntu 22.04
It turns out that the problem was that some permissions got clobbered in the /opt/graalvm folder. Removing and re-extracting the folder ...
Read more >
When using the official GraalVM Native Image, I am getting ...
I want to build a GraalVM Java Native Image. ... When using the official GraalVM Native Image, I am getting "Error: Unrecognized option:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found