Fork me on GitHub
#graalvm
<
2020-04-20
>
tees01:04:33

@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?

didibus01:04:36

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

didibus01:04:01

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

didibus01:04:12

Try adding the static option

thanks3 4
tees02:04:57

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.

didibus02:04:36

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

didibus02:04:47

Cause that also for sure won't work.

didibus02:04:05

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

tees14:04:46

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

borkdude14:04:00

@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

tees15:04:43

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

borkdude15:04:33

@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

tees15:04:25

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?

tees15:04:46

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.

borkdude15:04:26

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

borkdude15:04:18

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

tees15:04:33

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.)