I'm getting a weird issue when compiling a very mimimal project that has dependencies on [clojure.java-time "0.3.2"]
and [com.taoensso/timbre "4.10.0"]
with GraalVM native-image. Project is using [org.clojure/clojure "1.10.2-alpha1"]
and compiled with -Dclojure.compiler.direct-linking=true
.
native-image --no-fallback \
--initialize-at-build-time --allow-incomplete-classpath --report-unsupported-elements-at-runtime \
-jar ./target/test2-0.1.0-SNAPSHOT-standalone.jar
native-image can be compiled if either timbre or java-time is left out. It only occurs when a specific call to timbre/log is called:
(ns test2.core
(:require [taoensso.timbre :as log]
[java-time :as t])
(:gen-class))
(set! *warn-on-reflection* true)
(defn -main [& args]
(println "testing")
(log/info "testing") ;; no error is triggered
(println (t/local-date-time)) ;; no error is triggered
(log/info "local-date" (t/local-date-time))) ;; this triggers the compile error
Error:
Build on Server(pid: 51885, port: 54536)
[test2-0.1.0-SNAPSHOT-standalone:51885] classlist: 11,272.74 ms, 2.23 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (cap): 7,855.84 ms, 2.23 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] setup: 12,344.01 ms, 2.23 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (clinit): 5,899.36 ms, 2.73 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (typeflow): 366,268.13 ms, 2.73 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (objects): 103,610.17 ms, 2.73 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (features): 6,134.04 ms, 2.73 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] analysis: 501,193.69 ms, 2.73 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] universe: 9,507.73 ms, 2.74 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (parse): 48,237.15 ms, 2.75 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (inline): 47,334.52 ms, 2.85 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] (compile): 185,888.11 ms, 2.45 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] compile: 298,379.85 ms, 2.45 GB
[test2-0.1.0-SNAPSHOT-standalone:51885] image: 18,446.36 ms, 2.50 GB
Fatal error:com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: java_time.amount$days.invokeStatic(Object): has no code address offset set.
at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:647)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
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:177)
Caused by: com.oracle.svm.core.util.VMError$HostedError: java_time.amount$days.invokeStatic(Object): has no code address offset set.
at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
at com.oracle.svm.hosted.meta.HostedMethod.getCodeAddressOffset(HostedMethod.java:147)
at com.oracle.svm.hosted.image.LIRNativeImageCodeCache.patchMethods(LIRNativeImageCodeCache.java:159)
at com.oracle.svm.hosted.image.NativeBootImage$NativeTextSectionImpl.writeTextSection(NativeBootImage.java:943)
at com.oracle.svm.hosted.image.NativeBootImage.build(NativeBootImage.java:457)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:636)
... 7 more
Error: Image build request failed with exit status 1
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
@totoyok285 Could be a GraalVM bug. You can make a repro repository with clear build instructions and make an issue over there .