Trying to add CrashKiOS (for Crashlytics) to my li...
# touchlab-tools
b
Trying to add CrashKiOS (for Crashlytics) to my library, which uses dynamic linking. I have added the plugin as outlined in in the setup guide, but I’m still getting the linking errors:
Copy code
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: warning: ignoring duplicate libraries: '-ldl'
ld: Undefined symbols:
  _FIRCLSExceptionRecordNSException, referenced from:
      _co_touchlab_crashkios_crashlytics_FIRCLSExceptionRecordNSException_wrapper0 in shared.framework.o
  _OBJC_CLASS_$_FIRCrashlytics, referenced from:
       in shared.framework.o
  _OBJC_CLASS_$_FIRExceptionModel, referenced from:
       in shared.framework.o
  _OBJC_CLASS_$_FIRStackFrame, referenced from:
       in shared.framework.o
Not sure what I’m doing wrong?
Following up on this issue with dynamic libraries and the CrashKiOS plugin in case others run into the same problem. I figured out the issue. My KMP library has several modules. Even though the dependency (and code) only needs to be added to the “umbrella” module where the iOS framework is defined, it seems the plugin to resolve linking issues needs to be applied to all modules in the KMP library. Once I did that, everything builds nicely.
🎉 2
👍 1
k
Are you using CrashKiOS in those modules directly?
In theory, the only time the linker should get involved for framework builds is the umbrella, but tests need to build a test kexe file. However, the "linker" plugin shouldn't actually fix that. Linking 3rd party libs is a tough problem. Still trying to figure out a good general solution.
Anyway, test builds require dynamic links to be "satisfied", while the framework build can defer till the app runs. So, if the modules use CrashKiOS, tests wouldn't work.
b
@kpgalligan I’m not using CrashKiOS in those modules directly. I just have it in my umbrella module (and in that module, I just call the two methods to enable crashlytics and set the unhandled exception hook). I too was confused as to why my build still failed when applying the plugin to the umbrella module. But when I add it to all of the modules, everything compiles fine 🤷 … I have my own gradle Plugin in the project that I use to apply common build config/logic to all modules, so it was easy enough to apply the crashkios linker plugin there (as opposed to having to remember to manually add it to every module), so not a big deal for me. But still, just seemed odd that I had to do that.
k
But still, just seemed odd that I had to do that.
I can't imagine why you would. It's something we'll need to look at.
b
Is it possible this is something that was fixed in 0.8.6? I’m using 0.8.5, since my project is still on Kotlin 1.9.21 (for now).