Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate native image on Ubuntu 20: "error linking the native image" #55

Open
nicokosi opened this issue Mar 18, 2021 · 1 comment
Labels

Comments

@nicokosi
Copy link
Owner

nicokosi commented Mar 18, 2021

On my Ubuntu machine:

./generate-executable.sh

✂️

Fatal error:java.lang.RuntimeException: 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 libz.a is missing. Please install it.

✂️

/home/nkosinski/.sdkman/candidates/java/21.0.0.r11-grl/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -ldl -lpthread -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/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/home/linuxbrew/.linuxbrew/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
	at com.oracle.svm.hosted.image.NativeBootImageViaCC.handleLinkerFailure(NativeBootImageViaCC.java:474)
	at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:441)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:685)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
	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

Full log

git show
commit ab719ae7a8915512d3a8a8e1c47ab00e0e6679cb (HEAD -> master, origin/master, origin/HEAD)
Author: Renovate Bot <[email protected]>
Date:   Thu Mar 18 06:22:27 2021 +0000

    Update dependency org.clojure:clojure to v1.10.3
cat /etc/issue
Ubuntu 20.04.2 LTS \n \l
@nicokosi nicokosi added the bug label Mar 18, 2021
@nicokosi
Copy link
Owner Author

I found this work-around that worked on my machine (https://stackoverflow.com/questions/3373995/usr-bin-ld-cannot-find-lz) :

sudo apt-get install zlib1g-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant