How can I encode rpath for shared libs when using ...
# kotlin-native
k
How can I encode rpath for shared libs when using gradle? I've been trying by passing -Wl,-R/path/to/dynamiclib/ with linkerOpts but no matter what when I try to run it on a different device (Linux) it doesn't seem to encode it so that I can export the binary with its own shared libs rather than having user installing them/building them themselves
e
k
Ah that’s something I might have to look into
Unfortunately when passing $ORIGIN we have gradle complaining about:
Copy code
Unresolved reference: ORIGIN
Tried doing so as well via CLI but the executable still fails to detect the shared lib, seaports objdump showing the changes
e
you may need to add escaping to ensure
$
makes it all the way to the linker
objdump -p
should show a literal
RUNPATH              $ORIGIN
and not substituted
k
Okay looks like I got something. ldd ./binary shows a changing path for shared libs when I move the libs folder and the binary itself around so it seem to link properly. Gonna have to test it out later
RUNPATH is also $ORIGIN/lib/ that I set it up during compilation
Right so I've tested the binary on another pc but still getting 'cannot open shared object file' runpath works, it pinpoints to $ORIGIN but the moment i zip it up and send it off to another PC and try to run it complains it can't find the so. I'm getting it complaining about so.2.5 so the version number, but not about the .so itself. By going through ldd on the .so it does say that the version shared lib is not found. At this point idk if its Kotlin/native related at all
welp, managed to get it fixed but ofc it all went to shits because ofc openal and few other libs require glibc higher than 2.19 đŸ™‚