-
Notifications
You must be signed in to change notification settings - Fork 32
Compile to native binaries using GraalVM Native Image #36
Comments
I got this working with some tinkering, after needing to generate some configuration
First is the master jar, second is the GraalVM binary. This is purely via the executables, no Gradle yet. |
Right so to get to this result you need to install GraalVM and add it to your path:
And then install the Native Image plugin via:
The next important step is to make sure you have the following variables set to JDK 1.8 Home and Scala 2.11 Home, else the GraalVM image produced will fail with very odd errors. I manage everything via homebrew so the below are my own homebrew installation paths, replace as necessary:
And for convenience define the home of GraalVM as a var too:
Now we need to generate some files to deal with the usage of reflection in our dependencies. This is done via:
This will actually run the fat jar the current master creates and profile which libraries use reflection and write the results to
Now this should generate a perfectly functional |
Hi @muscovitebob - out of curiosity what is the end result ? i.e. "an executable that is x KBytes rather than y" Do you get executables for different linux / mac / win etc ? Share a bit insight as i haven't looked into Graal for a while - thx |
Hi @Antwnis! You create different, statically linked binaries for each target platform (Mac, Linux, Win). No JVM installation needed. Instead of manually creating the |
It should be possible to get rid of the JVM overhead using the GraalVM Native Image mechanism. I will take a look at this later, but have you folks already experimented with this route before?
The text was updated successfully, but these errors were encountered: