I have an issue with `Undefined symbols for archit...
# kotlin-native
c
I have an issue with
Undefined symbols for architecture x86_64
in a KMM project based on https://github.com/Kotlin/kmm-sample/blob/master/README.md. The ios framework (
:shared:linkDebugFrameworkIos
) only fails to link when disabling caching with
kotlin.native.cacheKind=none
(or if using Gradle composite builds for the dependencies), but works when using the cache when consuming the dependencies from a Maven repository. The unresolved symbols are defined as custom declarations in a cinterop-wrapper’s def-file and used by static libraries in the dependent module. The klibs passed to konanc seems right and the klibs seems to contain the right symbols in the
cstubs.bc
. The only difference on the konanc command line when it works (i.e. without
kotlin.native.cacheKind=none
) is a couple of additional
-Xcache-directory
entries, that indeed contains archives containing the symbols. I have tried getting details from the linking phase (by various `freeCompilerArgs`/ `linker-option`s) without luck. Any idea on how to get insight in the linker invocation through konanc or any known limitations/issues around linking against custom declarations in a module’s? The project is available at https://github.com/realm/realm-kotlin/tree/master/examples/kmm-sample
a
Hello, @Claus Rørbech! To get some insights about the konanc linking, one can try using
-Xverbose-phases=Linker
compiler argument.
c
Thanks, that seems to print the
ld
invocation too. I will try to decipher the outputs and see if it raises any questions.
It looks like only the static libraries of the dependencies klibs are passed to the linker and not the
cstubs.bc
(in any form). I created https://youtrack.jetbrains.com/issue/KT-44447 with steps to reproduce
🙏 1