Has anyone had any luck consuming a pod through co...
# kotlin-native
p
Has anyone had any luck consuming a pod through cocoapodsext? I’m attempting to use
TensorFlowLiteC
and/or
TensorFlowLiteObjC
from my
iosMain
but when I build in XCode it always complains about undefined symbols when linking. For example, adding
pod("TensorFlowLiteC")
to the KaMPKit Starter and adding
println(TfLiteVersion().toKString())
to the
initKoin {}
block in
KoiniOS.kt
results in
Copy code
Showing All Messages
Undefined symbols for architecture x86_64:

  "_TfLiteVersion", referenced from:

      _cocoapods_TensorFlowLiteC_TfLiteVersion_wrapper17 in result.o

ld: symbol(s) not found for architecture x86_64
when building in XCode (from the gradle output) I’m stumped as to what to look into next.
r
Make sure you make the framework static if you're importing pods through Gradle. KaMPKit has it dynamic by default.
p
I assume then there’s no way to consume pods with a dynamic framework?
r
Haven't done a lot of digging there, so it might be possible to get it working, but not out-of-the-box.
p
Are there many downsides to reverting to static framework? I believe I read something about debugging not being possible, nor the ability to have more than one K/N static framework in the same app?
r
Yeah debugging is why KaMPKit defaults to dynamic. I'm not aware off-hand of limitations on multiple static frameworks, but I haven't gone as deep on that stuff as other folks on our team. cc @Whitley @kpgalligan
The pods issue is here if you want to track it, help out, or ask us to look closer https://github.com/touchlab/KotlinCocoapods/issues/10
p
I’ve subscribed, thanks. Although the title seems inverted 🙂
r
oops
p
Interestingly, even with
isStatic = true
, it fails in the same way when linking tests for
iosTest
(when running with
kotlin.native.cocoapods.*
properties configured as in XCode build).
r
Interesting. Does that happen for the official cocoapods plugin as well? We didn’t change anything in the internals, just exposed more configuration options.
p
Just trying now
Yes it also happens with the official plugin
Odd - with
kotlin.native.cocoapods.paths.frameworks
set as set by XCode, and the call to the pod in
iosMain
,
linkDebugFrameworkIos
succeeds, but
linkDebugTestIos
fails to link when a test includes a call to the
iosMain
code that calls the pod.
p
We use TensorFlowLiteC and have a custom cinterop to wrap it as a pure K/N dependency.