Any idea how to make native library without cocoap...
# kotlin-native
j
Any idea how to make native library without cocoapod work? I'm following these instructions: https://kotlinlang.org/docs/mobile/add-dependencies.html#add-a-library-without-cocoapods But I get the following error when I try to run the tests:
dyld: Library not loaded: @rpath/MyFramework.framework/MyFrameworkMyFramework
Referenced from: /redacted/path/build/bin/ios/debugTest/test.kexe
Reason: image not found
My gradle setup is exactly as in the article, there are no warnings from the linker. I've checked several resources about xcode problems like this, tried settings from these answers: https://stackoverflow.com/questions/27174371/ios-8-dynamic-framework-library-not-loaded https://stackoverflow.com/questions/45542928/load-custom-dynamic-library-dylib-in-ios-application
a
t
it should work for running your app normally (did you try?), but for tests it’s broken. you need to add linkeropts manually.
ah I see you want without cocoapods. This thread is based on that but the way linker flags work should still help you hopefully.
a
@Tijl Now I’m creating iOS app on this example. Now app works without ktor-client (I’m debugging it)
j
@Tijl yeah, it looks like without cocoapods it should practically the same, thanks!
t
you might need to pass
-ObjC
to the linker as well depending on what you link, and maybe explicitly pass the frameworks, e.g.
Copy code
linkerOpts("-framework", "SomeFramework")
I also use a slightly different approach where instead of messing with
xcrun
I have a copy task that puts all the frameworks in a
Frameworks
directory next to
test.kexe
man ld
is your friend I guess