jschnasse
jschnasse

Reputation: 9588

Spring Native fails to Execute org.graalvm.buildtools

I followed the instructions on Getting Started Native Build Tools in order to create a standalone executable using Spring Native.

When I execute the package goal

mvn -Pnative -DskipTests package

I get the following error (I also get a lot of Could not register warnings, which should be okay according to the documentation)

/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
    at com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:513)
    at com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:460)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:710)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
    at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1
...
Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.0:build

How should I proceed?

Upvotes: 1

Views: 2487

Answers (1)

jschnasse
jschnasse

Reputation: 9588

sudo apt install zlib1g-dev

After that I was successfully able to start the application

Upvotes: 2

Related Questions