graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
tees 2020-04-20T01:44:33.171600Z

@borkdude - question re: the rust-clojure interop repo you built — I used it as a basis to compile a tool I'm building. It works on the machine I compile with, but when I move the binary to another computer it fails with a java.lang.UnsatisfiedLinkError — did you ever run into this?

2020-04-20T01:54:36.172100Z

My guess is that you're not doing a static binary

2020-04-20T01:55:01.172900Z

So the resulting binary assumes some libraries must exist on the machine for it to dynamically link against it

2020-04-20T01:55:12.173200Z

Try adding the static option

1
tees 2020-04-20T02:02:57.173800Z

Ah, that might be it. Thanks @didibus . Looks like you can't compile static on mac? Guess I'll have to set it up on my linux box.

2020-04-20T02:26:36.174700Z

Hum... Were you doing Mac build and running it on Linux?

2020-04-20T02:26:47.175100Z

Cause that also for sure won't work.

2020-04-20T02:27:05.175700Z

I also think cross-compilation isn't there yet for Graal

tees 2020-04-20T14:15:46.176300Z

Nah I was doing mac build and moving it to another mac.

borkdude 2020-04-20T14:49:00.177Z

@tees The idea is to copy the dynamic library from the resources to the filesystem and load it from there at startup: https://github.com/borkdude/clojure-rust-graalvm/blob/044ef3c921e7b2c9058e431a62574d85b1079011/clojure/src/clj_rust/core.clj#L10

tees 2020-04-20T15:10:43.178400Z

Ah. Sounds like perhaps it is not entirely possible to have a totally self contained binary with two languages.

borkdude 2020-04-20T15:13:33.179200Z

@tees The problem is that you cannot load native libraries from within your bundled resources. That's why you have to spit it out first. But this doesn't have to be visible to the end user

tees 2020-04-20T15:19:25.180500Z

Ah, so it seems like the linked function you posted above happens at compile time? And I would just switch that to happen at runtime?

tees 2020-04-20T15:23:46.181400Z

err, I see that it's transferring it from the resources to the home directory - so I guess the binary packages the lib, and then on runtime it should be copying it to my home dir.

borkdude 2020-04-20T15:24:26.181900Z

yes, at runtime there is a check to see if the lib is there, and if it isn't, it's copied

borkdude 2020-04-20T15:25:18.182700Z

I see there is no check if it's already there, but that could be implemented as well of course

tees 2020-04-20T15:25:33.182900Z

Hm, I must have messed something up on my own version; I'll double check what's happening in my code... (edit: it was just because my resources were failing to get included for some reason.)