https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Borja

09/21/2021, 1:39 PM
Hi there. I’m trying to use an objc library through cinterop but it crashes on run time with message
dyld: Library not loaded:
Does anyone had the same issue? I built a minimum repro repo here: https://github.com/flaquir4/MinimumRepro
b

Big Chungus

09/21/2021, 1:47 PM
Looks like some -L paths are missing in your linker opts
b

Borja

09/21/2021, 1:53 PM
Thanks for the answer, which paths do you mean? I didn’t see in the documentation and I’m not an expert on cross compiling.
b

Big Chungus

09/21/2021, 1:59 PM
Here's some examples for you to refer to. Basically cinterop requires some prior knowledge of how cmake finds correct headers and shared libraries to compile and link against. Most commonly used ones are these, google the rest: • [compileOpt]
-I/path/to/some/dir/that/has/header/files
this adds a directory to discover *.h files from • [linkerOpt]
-L/path/to/some/shared/lib/dir
this adds a directory to discover shared libraries from (e.g.
*.so
) • [linkerOpt]
-lmyLibName
this tells which libs to link against (should be discoverable from path defined by some sys defaults +
-L
args above) Hope this helps, I've never actually done any apple development to tell you more. All this is coming from my experience with K/N desktop targets, but the process should be similar.
b

Borja

09/21/2021, 2:13 PM
yes I tried those, but I think with apple.framework it behaves diferent.
4 Views