I have created multiplatform library with some cinterop libraries for
linuxArm64
and
linuxX64
. I published the library to my local maven repo. Now when i try to use the library in some project on
linuxX64
the build goes fine, but when i try to compile for
linuxArm64
i get
cannot find -l<library name>
and bunch of
undefined reference to <something>
. The library has
def
file with different linker paths for each architecture and build of the library goes fine for all build targets. The problem is only when i try to use the published library. So i am wondering what might be wrong here ?
František Jeřábek
12/05/2022, 12:52 PM
So i found out that the
.so
files must be on the same path as defined in the
.def
in the library even in the project that uses the library. Is there a way to package the library with the
.so
files it uses? I want to just add the library in the gradle and for it to work. So i dont have to worry about having all the
.so
files in the correct path
n
napperley
12/05/2022, 11:29 PM
Best practice for setting linking options is to do it on the Kotlin Native program side. A Kotlin Native library shouldn't be specifying linking options in order to be portable across platforms. Linking options can vary between Linux distributions.
napperley
12/05/2022, 11:36 PM
Alternatively static library files can be packaged with a Kotlin Native library, which has the big advantage of having all linking managed on the library side, instead of dealing with it on the program side.
f
František Jeřábek
12/07/2022, 11:39 AM
@napperley what do i have to do to package the static library files with the kotlin native library ?