Fork me on GitHub
Gerald T15:07:44

Hello, has anyone tried compiling native-image with taoensso.timbre. I'm doing a minimal lein project with nothing but these:

[org.clojure/clojure "1.9.0"]
[com.taoensso/timbre "4.10.0"]
and I get the following error:
Error: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,3,65,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_] stack: [71] locks: [] rethrowException]
Other frame state: [locals: [1,2,82,65,3,_,_,_,_,_,_,_,_,_,_,_,_,_,_] stack: [85] locks: [78 / 69] rethrowException]
Parser context: io.aviso.exception$write_exception_STAR_.invokeStatic(exception.clj:509) [bci: 55, intrinsic: false]
  55: checkcast     #25         // clojure.lang.IFn
  58: aload         4
  60: invokeinterface#7, 2       // clojure.lang.IFn.invoke:(java.lang.Object)java.lang.Object
  65: dup

Detailed message:
Call path from entry point to io.aviso.exception$write_exception_STAR_.invokeStatic(Object, Object, Object):
	at io.aviso.exception$write_exception_STAR_.invokeStatic(exception.clj:496)
	at io.aviso.exception$write_exception_STAR_.invoke(exception.clj:496)
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.RestFn.applyTo(
	at test2.core.main(Unknown Source)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1$NativeImageError: Image build request failed with exit status 1
Tried this command:
native-image --verbose -H:Log=registerResource: --no-fallback --initialize-at-build-time  --report-unsupported-elements-at-runtime -jar ./target/test2-0.1.0-SNAPSHOT-standalone.jar


@totoyok285 clojure + GraalVM native-image 101: use 1.10.2-alpha1. Also see the topic of this channel

Gerald T16:07:20

Yes, thanks just saw it at the top of the channel. Will try it now!

Gerald T16:07:02

I avoided 1.10.0 because I came across the locking issue, so going to try 10.2-alpha1

Gerald T19:07:06

Well checked with 1.10.2-alpha, and it managed to compile, but took nearly 1 hour to complete! Using 1.9.0 took a long time too, but I got impatient and stopped it, so it might just work. It only happens with timbre added to the extremely minimal project.


are you using ? It can make a huge difference in compilation time

Gerald T19:07:36

Yes, I already added that flag

Gerald T19:07:12

native-image --verbose -H:Log=registerResource: --no-fallback --initialize-at-build-time  --report-unsupported-elements-at-runtime -jar ./target/test2-0.1.0-SNAPSHOT-standalone.jar


I think you need to specify that flag when creating the uberjar


yea, its effect is during AOT compilation

Gerald T19:07:51

Thanks, I can try that as well


yeah, add during uberjar or clojure.core/compile

Gerald T07:07:10

Yup, it works after adding in that flag. I did add it to the leningen plugin native-image jvm-opts options initially, but that doesn't work if I'm generating the uberjar directly. Thanks guys!

Gerald T19:07:37

So I might have to switch to using instead