Hi, have you ever run into an issue with Kermit an...
# touchlab-tools
l
Hi, have you ever run into an issue with Kermit and multiply-defined symbols in release builds? We use Canard as a logging framework in our KMP library. Recently, we updated one of our dependencies, Compass, to its latest version, and that seems to have a conflict with
darwin_log_create
, maybe because it uses Kermit and they both define this symbol: [Kermit] [Canard]. (Full message in thread.) 1. I'm not sure why this only happens with release builds. 2. I'm not sure what changes might have happened in this library or in Kermit that would have made it start having this conflict.
Copy code
> Task :shared:linkReleaseFrameworkIosSimulatorArm64
e: Compilation failed: Linking globals named 'darwin_log_create': symbol multiply defined!

 * Source files:
 * Compiler version: 2.1.0
 * Output kind: FRAMEWORK

e: java.lang.Error: Linking globals named 'darwin_log_create': symbol multiply defined!
        at org.jetbrains.kotlin.backend.konan.llvm.DefaultLlvmDiagnosticHandler.handle(diagnosticReport.kt:26)
        at org.jetbrains.kotlin.backend.konan.llvm.LlvmDiagnosticCollector.flush(diagnostics.kt:36)
        at org.jetbrains.kotlin.backend.konan.llvm.LinkModulesKt.llvmLinkModules2(linkModules.kt:37)
        at org.jetbrains.kotlin.backend.konan.CompilerOutputKt.linkAllDependencies(CompilerOutput.kt:140)
        at org.jetbrains.kotlin.backend.konan.CompilerOutputKt.linkBitcodeDependencies(CompilerOutput.kt:177)
        at org.jetbrains.kotlin.backend.konan.driver.phases.BitcodeKt.LinkBitcodeDependenciesPhase$lambda$8(Bitcode.kt:133)
k
We had a PR for changing the implementation of
OSLogWriter
which appears to use the same name in cinterop as is used by Canard. Currently, the two libraries aren't compatible as a result. I'd never heard of Canard until this issue, but it looks like the PR to Kermit came pretty much from Canard, name and all. So, we'll have to investigate and see if renaming those cinterop functions will have any potential issues on release (probably not), then put out a new Kermit version.
Why only release? Could be several things. Depends on your build settings. But, summary, the Kotlin compiler is trying to create a new native symbol twice with the same name, and it can't.
Compass doesn't appear to use Kermit in the core library, but it does use Kermit in the demo app. I'm not sure how/why there would be a Kermit issue as a dependency if it's only in the demo sample. I looked at main, though. They might have had Kermit in there for the version you're using.
Kermit does appear as a dependency here but I don't see where it's being used in the module, which is odd.
l
Yeah, I see it too. It's included as implementation but only the demo app uses it. I guess this issue is happening for me now because our dependency of this library updated from a previous version to 2.0.0, which also updated Kermit.
So, we'll have to investigate and see if renaming those cinterop functions will have any potential issues on release (probably not), then put out a new Kermit version.
https://github.com/touchlab/Kermit/issues/434
Thank you so much! And to be clear, I wasn't blaming Kermit on this. I just wanted to figure out what was going on.
k
Well, it's not exactly a "blame" kind of situation. But, Kermit added the method fairly recently, and I'd guess the PR pulled the function name(s) from Canard, so it was a Kermit change. Curious if there's a reason for Kermit in that module in compass, or if the modules originally used Kermit, then pulled out those calls but didn't remove the dependency, or if that module's dependency was even the cause. But, the fix is changing the name in Kermit.
👍 1