Fork me on GitHub
#babashka-sci-dev
<
2022-05-27
>
cap10morgan20:05:50

I just (finally) got a Windows GraalVM native-image CI pipeline working on another project. Here's the GitHub Actions workflow: https://github.com/cap10morgan/opawssm/blob/843d64ff02b6e38851b1c7118b867d916f1ac1da/.github/workflows/ci.yml#L31

cap10morgan20:05:18

Want me to try converting that to a CircleCI config for babashka?

borkdude21:05:11

No thanks, we're good with Appveyor

cap10morgan21:05:37

ah, cool. wasn't sure if you were still looking for that. I saw some old comments you'd left in some places I was looking too. 🙂

borkdude21:05:25

The most friction in Windows + clojure CI comes from powershell issues. If you use deps.exe or bb clojure it's likely easier. @lee can confirm this with a recent build

borkdude21:05:45

You don't need to have a separate clojure CLI install using that

cap10morgan21:05:01

yeah, that was the first thing I got working locally

cap10morgan21:05:34

the scoop clojure cmd-clj and cmd-clojure shims seem to work too (from cmd.exe so you can setup the native-image env)

borkdude21:05:18

Yeah, but then you'd have to install scoop first :)

lread21:05:50

I wonder if the Clojure core team has thought of adopting deps.clj as its official launcher for Windows?

cap10morgan21:05:50

I was originally planning to use it to install some other things too. but might revisit since I didn't in the end.

borkdude21:05:26

On Github Actions + Windows you could just use setup-graalvm from the official graalvm repo + bb clojure and have thing compiling in a few minutes

cap10morgan21:05:32

I found I still needed to install MS build tools

borkdude21:05:43

The setup graalvm tool doesn't do that for you?

lread21:05:45

Yeah I’d been using deps.exe in the past, but since I have bb installed on every CI env I use, I’ll start using that.

cap10morgan21:05:16

doesn't seem to, unless I did something wrong (always a possibility)

borkdude21:05:23

FWIW, I don't like launching native-image from tools build (JVM) since I like to give native-image as much memory as I possibly can - this gives faster compile times

borkdude21:05:25

From the setup-graalvm action: • sets up Windows environments with build tools using https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line

cap10morgan21:05:16

hmm... I'll have to mess around w/ it some more. kept getting the "can't find cl.exe" error

lread21:05:33

Hmmm… you sure you are not using maybe DeLaGuardo/setup-graalvm instead of graalvm/setup-graalvm?

cap10morgan21:05:50

I might have been before. I'm using the official one now.

cap10morgan21:05:24

yep, it can find cl.exe now w/o me installing it. cool, thanks for pointing that out!

cap10morgan21:05:37

always love deleting a bunch of code 🙂

👍 1
borkdude22:05:58

@cap10morgan FWIW It seems your tool has only deps that can run directly with bb, except aws-api, but this port now runs directly in bb: https://github.com/grzm/awyeah-api :)

cap10morgan22:05:39

Yeah I started with that but had trouble with it under GraalVM

cap10morgan22:05:07

But it did work under bb when I was using that! :)

borkdude22:05:27

Hmm, what was the problem with graalvm? @grzm might want to know

cap10morgan22:05:05

I'd have to plug it back in and give it another try. Some dynamic loading stuff IIRC

borkdude22:05:17

Oh, dynamic loading... yeah that should probably be avoided altogether, since that blows up the image.

cap10morgan22:05:43

Yeah there's some happening inside the cognitect lib that I found instructions for avoiding. I tried applying those instructions to awyeah but couldn't quite get it to work.

borkdude22:05:39

Right, the aws-pod might have some of that too, not sure

grzm22:05:53

@cap10morgan Please do share when you get a chance. I’d definitely like to know.

👍 1
cap10morgan16:05:38

I did open this PR (in case you didn't see it) to fix the couple of reflection warnings you noted in your README. So that's the first thing that helps w/ graalvm. https://github.com/grzm/awyeah-api/pull/1

grzm16:05:43

Cheers. I've seen it, just been busy. Can you elaborate on how fixing the reflection warning helps with graalvm?

cap10morgan16:05:52

graal needs a reflection config JSON file for any runtime reflection you need it to do. so any that you can eliminate instead is much nicer. not sure if there are performance implications too, but keeping that file short to non-existent is nice.

cap10morgan19:06:04

I think the rest of the native-image issues were not directly related to awyeah. I put it back in and everything seemed to build and run correctly. So yay!

cap10morgan19:06:01

Some of the cognitect api suggestions are still in place (e.g. passing an http client instance), but I haven't had a chance to test if they're necessary or not. Can investigate a little further next week.

cap10morgan19:06:41

I'm also thinking of porting my app to bb, caxa, and bb/cli so it's highly likely I'll stick with awyeah :)