-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat (dist): Native Image {WIP, *BROKEN*} #385
base: main
Are you sure you want to change the base?
Conversation
28642e5
to
3971f64
Compare
This PR is still very much a DRAFT as-is currently, it fails due to: $ bazelisk build //cli:enola-native
INFO: Analyzed target //cli:enola-native (235 packages loaded, 4959 targets configured).
INFO: Found 1 target...
ERROR: /home/vorburger/git/github.com/vorburger/enola/cli/BUILD:51:13: Native Image (fastbuild) //cli:enola-native failed: (Exit 1): native-image failed: error executing command (from target //cli:enola-native) external/rules_graalvm~0.10.3~graalvm~graalvm/bin/native-image --no-fallback '-H:Class=dev.enola.cli.Enola' '-H:Name=enola-native-bin' '-H:Path=bazel-out/k8-fastbuild/bin/cli' ... (remaining 8 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Error: Classes that should be initialized at run time got initialized during image building:
org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
org.slf4j.jul.JDK14LoggerAdapter was unintentionally initialized at build time. To see why org.slf4j.jul.JDK14LoggerAdapter got initialized use --trace-class-initialization=org.slf4j.jul.JDK14LoggerAdapter
To see how the classes got initialized, use --trace-class-initialization=org.slf4j.LoggerFactory,org.slf4j.jul.JDK14LoggerAdapter
com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
org.slf4j.jul.JDK14LoggerAdapter was unintentionally initialized at build time. To see why org.slf4j.jul.JDK14LoggerAdapter got initialized use --trace-class-initialization=org.slf4j.jul.JDK14LoggerAdapter
To see how the classes got initialized, use --trace-class-initialization=org.slf4j.LoggerFactory,org.slf4j.jul.JDK14LoggerAdapter
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ProvenSafeClassInitializationSupport.checkDelayedInitialization(ProvenSafeClassInitializationSupport.java:277)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:164)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:86)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:179)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:767)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
========================================================================================================================
GraalVM Native Image: Generating 'enola-native-bin' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing... (6.0s @ 0.21GB)
Java version: 20.0.2+9, vendor version: GraalVM CE 20.0.2+9.1
Graal compiler: optimization level: b, target machine: x86-64-v3
C compiler: gcc (null, null, 0.0.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
1 user-specific feature(s)
- com.oracle.svm.thirdparty.gson.GsonFeature
[2/8] Performing analysis... [*] (18.1s @ 0.47GB)
4,465 (74.18%) of 6,019 types reachable
5,974 (54.67%) of 10,927 fields reachable
21,900 (47.60%) of 46,010 methods reachable
1,461 types, 89 fields, and 861 methods registered for reflection
------------------------------------------------------------------------------------------------------------------------
1.8s (7.2% of total time) in 75 GCs | Peak RSS: 1.04GB | CPU load: 5.87
========================================================================================================================
Finished generating 'enola-native-bin' in 24.3s.
Target //cli:enola-native failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 32.141s, Critical Path: 25.60s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully This looks like oracle/graal#2008? Even though that's about Log4j v2, which Enola doesn't use, just plain SLF4j. This comment says, quote: "GraalVM 21.0.0 now supports MethodHandles, isn't that fix the issue?" It looks like that GraalVM 21.0.0 came out 2 years ago - but this PR as-is still uses 20.0.2 right now... and switching to a more recent version fails, for me; probably needs sgammon/rules_graalvm#143. PS: I'm wondering if this isn't just the 1st of many more problems on this path. Perhaps building directly on top of e.g. https://quarkus.io/guides/building-native-image (more so than https://picocli.info/picocli-on-graalvm.html) instead of like this is more effective? Perhaps I'll try that, some other time (this is not a high priority for Enola; I was just curious). |
https://github.com/sgammon/rules_gradle could be fun to "industrialize" a Gradle (instead Maven) based Quarkus sub-project in this repo (after first manually trying it out). Or perhaps #391 is more worthwhile to pursue, first. Actually the first and simplest step would be to already to #334! 😈 |
#337