This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-13
Channels
- # announcements (5)
- # babashka (35)
- # beginners (65)
- # braveandtrue (3)
- # calva (20)
- # cider (6)
- # clara (11)
- # cljs-dev (36)
- # cljsrn (64)
- # clojure (65)
- # clojure-europe (6)
- # clojure-germany (13)
- # clojure-italy (14)
- # clojure-nl (22)
- # clojure-spec (16)
- # clojure-sweden (6)
- # clojure-uk (81)
- # clojurescript (71)
- # conjure (120)
- # cursive (3)
- # datomic (10)
- # events (4)
- # figwheel (4)
- # figwheel-main (5)
- # fulcro (36)
- # ghostwheel (1)
- # graalvm (8)
- # helix (9)
- # jobs (4)
- # jobs-discuss (12)
- # kaocha (33)
- # leiningen (5)
- # luminus (1)
- # off-topic (24)
- # pathom (7)
- # rdf (4)
- # re-frame (3)
- # reagent (15)
- # reitit (11)
- # remote-jobs (1)
- # shadow-cljs (97)
- # slack-help (3)
- # spacemacs (23)
- # vim (15)
- # xtdb (35)
I'm trying to native compile the following:
(ns graal.me.maybe.core
(:gen-class)
(:require [clj-http.client :as client]))
(defn -main [& args]
(time
(:body (client/request
{:method :get
:url ""}))))
And here's my build script:
clj -A:uberjar
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-19.3.2/Contents/Home/bin/native-image \
-H:+ReportUnsupportedElementsAtRuntime \
-H:ReflectionConfigurationFiles=reflectConfig.json \
-H:+ReportExceptionStackTraces \
-H:+TraceClassInitialization \
-jar ./target/foo-1.0.0-SNAPSHOT-standalone.jar \
foo
I've tried two paths with the following issues:
1. The above. When I run the output I get .FileNotFoundException: Could not locate clojure/core__init.class, clojure/core.clj or clojure/core.cljc on classpath.
.
2. I've added the --initialize-at-build-time
flag. When I do this I get a bunch of build errors along the lines of "Error: No instances of http://javax.net.ssl.SSLContext". However, the image does build.
Any tips on a happy path here?@markbastian clj-http is known not to work with GraalVM. clj-http-lite is
Cool, I'll try that. Do you recommend ce version 20 or 19?
@markbastian for SSL you must add some flags: https://github.com/borkdude/babashka/blob/master/script/compile#L44-L45
@markbastian also take a look at https://github.com/taylorwood/clojurl which essentially wraps clj-http-lite in a graal binary
@markbastian there's also this even lighter curl wrapper: https://github.com/borkdude/babashka.curl
Cool, thanks! I'll check those out.