Fork me on GitHub
#graalvm
<
2019-08-09
>
taylor02:08:58

@benzap the Could not locate clojure/core__init.class or clojure/core.clj on classpath error is due to a change they made in the defaults of the first GraalVM release. You now need to specify a flag (for Clojure apps) --initialize-at-build-time

👍 4
benzap09:08:08

This resolved my issue. Thanks a ton

taylor02:08:07

(this used to be a default)

taylor02:08:05

one issue with compiling 1.10 apps is 1.10 depends on a version of clojure.spec that uses locking, and locking doesn’t play well with native-image at the moment, but… you can “patch” calls to it if you really want

benzap09:08:05

I haven't used clojure.spec whatsoever. The original test involved 1.9, i'll try 1.10 and see if it works. Was having issues gettingit working without the fallback

benzap09:08:18

Original tests did not work, so we'll see

borkdude09:08:57

@taylor maybe it would be cool to have a lib which bundles the compiled .class file and patches a selection of functions in clojure which uses locking using alter-var-root

taylor02:08:59

this would certainly be convenient, but I think I’d rather it be less convenient for people to clobber clojure.core stuff, or at least I’d feel bad about it 😄

borkdude07:08:05

that's why I suggested to hide the alter-var-roots behind functions so people can apply these patches selectively, only when compiling to a binary

borkdude07:08:21

so the JVM version of their tools would remain unchanged

👍 4
borkdude09:08:06

[clj-native/locking-patch "0.0.1"] + (require '[clj-native.locking-patch :as lp]) (lp/apply-locking-patch!)

borkdude09:08:39

or [clj-native/patches ...] with more patches if needed

borkdude09:08:20

so the patches can be selectively applied (e.g. only when compiling a binary and not when running your tool with the JVM)

robertkrahn13:08:13

Hello! Does anyone have some experience of using java.time with native-image compilation? I have a case where a non-english time string can't be parsed in the compiled binary. In particular

(let [pattern (DateTimeFormatter/ofPattern "y-M-d[ ][cccc][ccc][ ]H:m" Locale/GERMAN)]
         (LocalDateTime/parse "2018-12-03 Mo 02:17" pattern))
throws java.time.format.DateTimeParseException: Text '2018-12-03 Mo 02:17' could not be parsed at index 11 but works with JVM 8/11. I assume that language support is stripped during compilation. Any way of enabling it again?