Fork me on GitHub
#graalvm
<
2019-11-08
>
borkdude11:11:46

I updated my notes: https://gist.github.com/borkdude/dd0857cf1958b25496fddbdbf359ca59#trying-to-compile-only-using-toolsdeps I have some trouble AOT-ing stuff like leiningen does, using tools.deps. Not sure what needs to be done

borkdude11:11:37

At least I have some docs to get started when new patches come out

borkdude11:11:03

more luck now!

$ ./spec-test
{:major 1, :minor 11, :incremental 0, :qualifier master, :interim true}
true
updated notes

👍 4
eraserhd14:11:39

@lee the hint is that you need to patch clojure, then build it, then build spec.alpha with the patched clojure.

eraserhd14:11:52

Then make sure you are using both deps.

eraserhd14:11:39

IMHO clj-1472-3.patch is simple and sufficient. Ghadi's changes the clojure compiler to be able to generate the correct bytecode for locking, saving a method call and adding some code to the clojure compler.

eraserhd14:11:36

I think locking is, by definition, not performant, and it's also not idiomatic in Clojure, so that's why my vote goes for 1472.

eraserhd14:11:48

er, clj-1472-3.patch

eraserhd14:11:30

(clj-1472-3.patch uses a native Java method which is passed a callable to lock an object)

borkdude14:11:36

@eraserhd I think if you would post this in JIRA or #clojure-dev (or both) more Cognitect people would see this

borkdude14:11:34

very interesting, thank you for sharing this. I'll include it in the notes

borkdude14:11:59

and how brave you're building with a patched clojure 🙂

eraserhd14:11:38

It was after listing to Bozhidar's talk at the last conj (or the one before?) and making a commitment to not work around other Clojure community efforts even when it was a bit more painful.

eraserhd14:11:08

(rep was half complete and written in something else)

borkdude14:11:26

maybe there could be a Github action or CircleCI orb with a graalvm patched clojure 😛

Alex Miller (Clojure team)14:11:54

It would be helpful if someone could capture any info about this in the jira ticket. I am seeing it, but I am also immediately forgetting it :)

borkdude14:11:38

I'm not sure what to add to the JIRA ticket, but I have written down some things here, just so next time I'll still remember what to do: https://gist.github.com/borkdude/dd0857cf1958b25496fddbdbf359ca59

borkdude14:11:03

@eraserhd any reason you're building 1.10.0-master-SNAPSHOT and not 1.11.0-master-SNAPSHOT?

borkdude15:11:07

@eraserhd I'm getting: {"error":{"code":"JwtAuthoriser:TokenExpiredError","title":"Token verification failed: jwt expired","href":""}} locally

eraserhd15:11:01

I'm not using that script anymore, since I vendored the artifacts in that repo.

eraserhd15:11:24

But I think we can actually just publish a clojure fork to clojars for use with Graal.

eraserhd15:11:58

hrmm, will it be a problem if it has a different group ID?

eraserhd15:11:11

In any case, I think that's attempting to download the clj-1472-3.patch. There's no reason that it isn't a later version of Clojure, other than I haven't needed to update it.

lread15:11:45

A thought: if it is referenced via deps.edn git:url we can provide any group-id/artifact-id we like, right?

lread15:11:06

And thanks @eraserhd, great to have info from someone who has actually succeeded at patching clojure for graal.

lread15:11:11

Also nice to have your gist up @borkdude with helpful reminders!

lread15:11:01

@borkdude, adding a link to your gist in JIRA clj-1472 would likely be helpful to others.

lread15:11:45

@eraserhd I think adding our humble opinion about clj-1472-3.patch to the the JIRA issue would help. It is not a pro/con spreadsheet but does capture a pro.

borkdude15:11:58

I added eraserhd's comment to the gist as well

Alex Miller (Clojure team)15:11:06

using clojure forks with deps.edn is not possible (or difficult) due to the default clojure being baked into the installation deps.edn

Alex Miller (Clojure team)15:11:55

this was not intentional but I've certainly run into trying to test my own stuff at times

eraserhd15:11:02

ah, interesting

borkdude15:11:27

added the link to my gist to the JIRA issue as a comment

Alex Miller (Clojure team)15:11:29

in particular, having it baked in in combination with known issue of dep replacement across different coord types

borkdude15:11:01

boot supports setting this:

BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.10.1

borkdude15:11:17

so I might try boot instead of leiningen for baking the uberjar, see if that works

Alex Miller (Clojure team)15:11:18

I just need to fix the issue above - then it would be fine

lread15:11:02

so an {:override-deps {org.clojure/clojure {:git/url "some-fork" :sha "some-sha"}} is not gonna work, right?

eraserhd15:11:14

This does work if you use a patched org.clojure/clojure as a filesystem artifact thogh.

lread15:11:16

k, thanks

borkdude15:11:35

yeah, so in CI it would not be a problem if you build it locally first

Alex Miller (Clojure team)15:11:38

I mean, it won't work anyways b/c that relies on source-only libs, and clojure is compiled

Alex Miller (Clojure team)15:11:08

but it would be nice if you could do :local/root replacement to a jar

borkdude15:11:26

and maybe keeping the fork local in a CI env to produce a single binary is better, since spreading forks with patches around can get messy 😉

lread15:11:43

good point

Alex Miller (Clojure team)15:11:31

certainly, I'd prefer there not to be N forked versions of Clojure floating around as that quickly becomes a problem for support and compatibility

👍 8
eraserhd15:11:34

It occurs to me that if you don't want to mess with patching and building, the jars are here: https://github.com/eraserhd/rep/tree/develop/deps

Alex Miller (Clojure team)15:11:02

I consider a fork to be like a very strong vote in ask/jira :)

borkdude15:11:43

@eraserhd that's helpful, thanks

eraserhd15:11:46

hah, well this is definitely a pain point. I'll try and comment on the JIRA issue soon.

borkdude15:11:15

@eraserhd it seems you're also using tools.deps to compile the main namespace. that's the only thing that worked for me with a patched clojure

borkdude15:11:50

I also had to add --report-unsupported-elements-at-runtime which I've avoided for all my binaries so far, but with a patched clojure it seems needed somehow

eraserhd15:11:09

Interesting

eraserhd15:11:51

wrt deps.edn, what I'm now doing is complicated. deps.edn is used for development, but building with GraalVm is using clj2nix to make deps.nix from deps.edn

eraserhd16:11:10

Though, I think it did work with deps.edn.

borkdude16:11:27

yeah, calling compile manually

lread20:11:36

I created a little bash script to carry out steps outlined in @borkdude's gist. I builds and locally installs spec.alpha 0.2.176-patch1472 and clojure 1.10.1-patch1472

borkdude20:11:29

@lee that's neat! is this available in a gist somewhere, where I can link to from my doc?

borkdude20:11:07

or in a public git repo for that matter

lread20:11:22

hmmm... repo might be good idea if we want to adjust.

lread20:11:26

and collab

borkdude20:11:34

yeah, I was thinking the same

lread20:11:05

will create a repo

👍 4
borkdude20:11:31

this is probably the cleanest bash I've ever seen 😉

lread20:11:21

oh pshaw. 😊

Alex Miller (Clojure team)20:11:13

I find shellcheck to be a fantastic tool for linting bash, if you're like .... into linting

lread20:11:33

oh my! Exciting! thanks!

Alex Miller (Clojure team)20:11:02

I use the cli but the site's good for getting an idea

lread20:11:50

clj-kondo for bash!

Alex Miller (Clojure team)20:11:55

I learned a lot about bash using it

lread20:11:58

bash continues to surprise me (in both good and bad ways).

borkdude20:11:04

@alexmiller I've been using it since you recommended it a while back and it's been fantastic

borkdude20:11:36

> bash continues to surprise me (in ... bad ways). this is one of the rationales for babashka: https://github.com/borkdude/babashka 🙂

borkdude20:11:37

I just used it like this: https://twitter.com/borkdude/status/1192884596431568896 I've tried this before using xargs, but if it takes more than 5 minutes reading in man pages or StackOverflow, I'd rather write Clojure

borkdude20:11:24

@lee also, there's flycheck integration for shellcheck, I've set that up

borkdude20:11:38

or it might even be supported out of the box if you have the binary installed

lread21:11:10

just had to brew install shellcheck and add spacemacs shell-scripts layer and voila! Thanks!

borkdude20:11:16

(don't remember which editor you are using)

lread20:11:31

spacemacs... will check it out for sure.

eraserhd21:11:52

Hey, if anybody here is going to the Conj and wants to talk aobut Graal or command-line tooling (especially for editors), hit me up.

lread21:11:03

Would if I could, sounds like fun @eraserhd!

borkdude22:11:20

@lee How to proceed? Want me to join as a committer to post my notes there?

lread22:11:49

oh good idea!

lread22:11:17

lemme check how to add you as a committer...

eraserhd21:11:25

I hadn't seen the page yet this year

sogaiu21:11:26

darn...wish i could attend

borkdude21:11:35

I would join that unsession if I was there

eraserhd21:11:25

I was hoping you would be. Someone just pointed me at babashka even :)

borkdude22:11:47

I promoted it via a tweet 🙂