Spring 本机无法执行 org.graalvm.buildtools

Spring Native fails to Execute org.graalvm.buildtools

我按照 Getting Started Native Build Tools 上的说明进行操作 为了使用 Spring Native.

创建一个独立的可执行文件

当我执行包目标时

mvn -Pnative -DskipTests package

我收到以下错误(我也收到很多 Could not register 警告,根据文档应该没问题)

/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(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

我应该如何进行?

sudo apt install zlib1g-dev

之后我就可以成功启动应用程序了