Hey folks, I trying to generate a native image for a telegram bot that uses morse (https://github.com/Otann/morse) 🧵
While build the native image I am getting this error related to a Thread being started:
Fatal error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. Thread name: clojure.core.async.timers/timeout-daemon. Threads running in the image generator are no longer running at image runtime. Prevent threads from starting during image generation, or a started thread from being included in the image.Here is the complete output: https://gist.github.com/macielti/e4f37ea45c7bda493e8cc565f04f82ca
I know that this is related to this code: https://github.com/clojure/core.async/blob/f0cb33ca0fbc5b63614eedde7c3ac026675af70e/src/main/clojure/clojure/core/async/impl/timers.clj#L53
but I don't have enough knowledge to circumvent that
that code is ok, but it's not ok to deref that thing on the top level
you could try to compile an example program that has less code and add stuff until it fails, this should give you a clearer picture of what code triggers this
At the top level it is in this line (p/start token bot-api) . I think that I will have to go deep on the library implementation
where is that line, in your project?
it is in a branch from the forked repository graalvm-clojure
https://github.com/macielti/graalvm-clojure/blob/add-morse/morse/src/simple/main.clj#L29
I created a draft pull request https://github.com/clj-easy/graalvm-clojure/pull/68
I event tried to use a when to only call the (p/start token bot-api) when the start argument is provided via command line to avoid this being interpreted at the build time. But it did not worked, I am not sure if GraalVM works this way
it's late here but I might check tomorrow time willing
nice, I really appreciate your willingness to help. I will wait.
@brunodonascimentomaci have you figured out this issue in the end? I'm trying to build a native image with morse, and running into the same issue.