Closed i10416 closed 3 years ago
Is the native-image-configs
folder meant to be generated by the end user in the demo?
Cloned this repo to try on Windows. When building, I get this:
rayga@DESKTOP-88A51E5 MINGW64 ~/Projects/tmp/JWM/examples/sbt (add-example)
$ sbt.bat -Dsbt.log.noformat=true 'show nativeImage'
[info] welcome to sbt 1.5.5 (GraalVM Community Java 16.0.2)
<SNIPPED>
[info] C:\GraalVM\graalvm-ce-java17-21.3.0-dev\bin\native-image.cmd -cp C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image-internal\manifest.jar -H:ReflectionConfigurationFiles=C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image-configs\reflect-config.json -H:ConfigurationFileDirectories=C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image-configs -H:+JNI --no-fallback --report-unsupported-elements-at-runtime --allow-incomplete-classpath io.github.humbleui.jwm.examples.Example C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example
[C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example:18952] classlist: 4,319.00 ms, 0.96 GB
[C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example:18952] (cap): 5,956.32 ms, 0.96 GB
[C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example:18952] setup: 7,286.96 ms, 0.96 GB
Error: The reflection configuration file "C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image-configs\reflect-config.json" does not exist.
[C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example:18952] [total]: Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
11,693.93 ms, 0.96 GB
# Printing build artifacts to: C:\Users\rayga\Projects\tmp\JWM\examples\sbt\target\native-image\example.build_artifacts.txt
Error: Image build request failed with exit status 1
[error] native-image command failed with exit code '1'
[error] (nativeImage) native-image command failed with exit code '1'
[error] Total time: 17 s, completed Oct 3, 2021, 12:48:44 PM
Is the native-image-configs folder meant to be generated by the end user in the demo?
@GavinRay97 Yes, those files are generated by sbt nativeImageRunAgent
command. Did you run sbt nativeImageRunAgent
?
sbt nativeImageRunAgent
command generates target/native-image-configs directory and configuration files.
Sorry, you need to run not nativeImage
but nativeImageCommand
first.
cd examples/sbt
// nativeImageCommand fetches graalvm and native image command.
sbt nativeImageCommand nativeImageRunAgent
sbt nativeImage
Running sbt nativeImage
for the first time can fail and this is not problem. This is just for fetching missing graal native agent components.
Then run sbt nativeImageRunAgent
and retry sbt nativeImage
command, I think it works.
Ahhh okay, yeah this the step I missed -- thanks!
Thank you for trying this! If something still goes wrong, please feel free to ask!
Thanks for the PR, merged to main.
I renamed examples/sbt to examples/native-image, seems to be better-suited.
One thing though: right now .java in examples/native-image is a copy of .java from examples/dashboard. I would prefer if we shared source files somehow, otherwise they will start drifting at some point. Is it possible with sbt?
@tonsky
Is it possible with sbt?
yes, Iwill send PR soon.
Add an example sbt project that can build dashboard example app into standalone binary with graal vm native image on Windows and Linux.
To add an example, I moved examples/ to examples/dashboard/