graalvm

Wanishing 2022-12-16T11:41:42.561819Z

Hi all:slightly_smiling_face: I'm trying to build a graalvm native-image of my personal cli tool that uses https://github.com/grzm/awyeah-api. When I run the command with unberjar everything works, but when I run the same command with the binary I get: > Exception in thread "main" java.io.FileNotFoundException: Could not locate com/grzm/awyeah/http/awyeah__init.class, com/grzm/awyeah/http/awyeah.clj or com/grzm/awyeah/http/awyeah.cljc on classpath. When building the image, I do see the package is being registered:

[clj-easy/graal-build-time] Registering packages for build time initialization: clojure, babashka, cheshire, clj_easy, com.grzm.awyeah, mal
When I run jar -tf <my-jar> | grep com/grzm/awyeah/http/awyeah.clj I do see this file present. My tool's setup is similar https://github.com/borkdude/jayfu setup, and was working fine till I've added the awyeah dependency. Has anyone encountered this issue? I suspect it's some graalvm-related configuration but I can't understand what.

borkdude 2022-12-16T12:00:44.534189Z

Can you upload your repo somewhere? I’ll take a look later today

Wanishing 2022-12-16T12:05:25.877939Z

@borkdude Unfortunately this repo is on my workplace private organization, but I'll create a minimal one now to reproduce the error. Thanks! BTW: I'm a huge fan and truly excited to converse with you:blush:

❤️ 1
Wanishing 2022-12-16T12:37:54.716159Z

Hi, I've created some minimal repo (just need to invoke main to get the error): https://github.com/wanishing/awyeah-graalvm

borkdude 2022-12-16T13:45:07.494969Z

@tal.vanish I think the issue is that those namespaces that are reported are lazily loaded

borkdude 2022-12-16T13:45:08.527789Z

When you require them in the namespace of your main function, it might work

Wanishing 2022-12-16T13:59:58.708489Z

Do you mean adding this to my core.clj file?

(require '[com.grzm.awyeah.client.api :as aws]
         '[com.grzm.awyeah.config :as config]
         '[com.grzm.awyeah.credentials :as credentials])
It didn't work/-:

borkdude 2022-12-16T14:01:03.712809Z

What about: > com/grzm/awyeah/http/awyeah

borkdude 2022-12-16T14:01:09.334589Z

that you reported earlier

borkdude 2022-12-16T14:05:04.904059Z

btw, it's possible to use this library from babashka as well, if you want fast startup

Wanishing 2022-12-16T14:16:34.848079Z

I didn't now that. How can I use it? I've added com.grzm.awyeah.http.awyeah and com.grzm.awyeah.protocols.rest-xml to my main namespace and it did work! thank you dearly:pray:

👍 1
borkdude 2022-12-16T14:19:04.110959Z

@tal.vanish You can use it from babashka the same way you would use it with clojure, like this: https://github.com/grzm/awyeah-api#bbedn

Wanishing 2022-12-16T14:39:42.752289Z

Got it:) Thank you again I don't think I would have come up with this solution any time soon