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

[native-image] native image failed to build jar #411

Closed
sound2gd opened this issue May 8, 2018 · 7 comments
Closed

[native-image] native image failed to build jar #411

sound2gd opened this issue May 8, 2018 · 7 comments
Assignees

Comments

@sound2gd
Copy link

sound2gd commented May 8, 2018

I am a clojure user and I use leiningen to build a executable fat jar.

it can be runned directly using java -jar, but when I use native-image -jar

It stucked and hung forever

here is the output
image

$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
GraalVM 1.0.0-rc1 (build 25.71-b01-internal-jvmci-0.42, mixed mode)

lein -v
Leiningen 2.8.1 on Java 1.8.0_161 GraalVM 1.0.0-rc1
@cstancu
Copy link
Member

cstancu commented May 8, 2018

@sound2gd thank you for your report, we'll look into it!

@cstancu
Copy link
Member

cstancu commented May 8, 2018

@sound2gd can you provide the steps to build that jar?

@sound2gd
Copy link
Author

sound2gd commented May 9, 2018

@cstancu sorry for late reply. here is the step.

first make sure you have installed leiningen
then

$ lein new luminus graal-test
Retrieving luminus/lein-template/2.9.12.54/lein-template-2.9.12.54.pom from clojars
Retrieving luminus/lein-template/2.9.12.54/lein-template-2.9.12.54.jar from clojars
Generating a Luminus project.

$ cd graal-test
$ lein uberjar
....
Created graal-test/target/uberjar/graal-test-0.1.0-SNAPSHOT.jar
Created graal-test/target/uberjar/graal-test.jar

$ native-image -jar ./target/uberjar/graal-test.jar

@cstancu
Copy link
Member

cstancu commented May 16, 2018

@sound2gd I tried to replicate the issue on my machine and I get a different behavior. The native-image runs for ~4 minutes but the build crashes because it detects unsupported features. On my machine the heap size of native-image gets up to the max, 14GB. You probably have less memory on your machine so the native-image runs with much less and at some point the GC occupies most of the execution. Eventually you would have probably seen an out of memory error from the JVM. I will analyze this further to see why it needs to allocate this much memory.

@sound2gd
Copy link
Author

@cstancu thanks for your effort, looking forward to your solution

@mping
Copy link

mping commented Jul 2, 2018

I have the same problem while trying to build https://github.com/mping/compojure-api-chassis. There's a makefile in that repo for building with native-image in case you need a test repo.

I tried with rc3.

@jramirez-isc jramirez-isc self-assigned this Feb 19, 2020
@jramirez-isc
Copy link

This is the same issue has the reported here: #428
It was already fixed, see this comment to know more about the fix.
I've tested in versions 19.3.1 and 20.0.0 and it's not happening anymore.

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

No branches or pull requests

4 participants