jlrs icon indicating copy to clipboard operation
jlrs copied to clipboard

Ship rust application with libjulia

Open Roger-luo opened this issue 1 year ago • 5 comments

It'd be very useful if we can ship a rust application with libjulia get included, I assume this should be possible if there is some kind of fake -src crate created for libjulia and let it finds local Julia and copy the shared library?

Roger-luo avatar Apr 06 '23 16:04 Roger-luo

I don't think such a crate is necessary, rather the binary needs to be able to find the libraries it depends on at runtime, either through environment variables or by setting an rpath. I have never tested this, though.

Taaitaaiger avatar Apr 06 '23 20:04 Taaitaaiger

do we have something that finds libjulia at runtime already? so that we can ship a binary and link to system julia (or whatever other available) directly

Roger-luo avatar Apr 06 '23 20:04 Roger-luo

As I understand it, libjulia is dynamically linked, so as long as it can be found at runtime (via the Path environment variable on Windows, or LD_LIBRARY_PATH on Linux) it should be possible to use a binary compiled on another machine.

The only major limitation I expect is that the version of Julia must be compatible with jlrs, and that this version is used at compile time and runtime. It won't be possible to compile against Julia 1.6 and link against 1.8 at runtime, for example.

Taaitaaiger avatar Apr 07 '23 08:04 Taaitaaiger

Is this because Julia doesn't have a stable ABI yet?

Roger-luo avatar Apr 07 '23 15:04 Roger-luo

Yes. In my experience there are minor, but backwards-incompatible, changes every version. Sometimes it's the signature of a function, sometimes it's the layout of a type.

It would be nice if Julia had something similar to NAPI (I'm more familiar with that than Python FFI), but I've never really thought about what that should look like.

Op vr 7 apr. 2023 17:19 schreef Rogerluo @.***>:

Is this because Julia doesn't have a stable ABI yet?

— Reply to this email directly, view it on GitHub https://github.com/Taaitaaiger/jlrs/issues/79#issuecomment-1500383030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOQBHH44EVOC3BQZGU437PLXAAWALANCNFSM6AAAAAAWVUUHPU . You are receiving this because you commented.Message ID: @.***>

Taaitaaiger avatar Apr 07 '23 15:04 Taaitaaiger