I found a small (but devastating!) bug in Kotlin/N...
# compiler
j
I found a small (but devastating!) bug in Kotlin/Native. In places, .klib files omit symbols generated with IR and that can cause a crash when deserializing 'em:
Copy code
18:28:11 e: java.lang.IllegalStateException: Expecting descriptor for app.cash.zipline.internal.bridge/SuspendCallback.Companion.Adapter|null[0]
18:28:11 	at org.jetbrains.kotlin.backend.konan.serialization.KonanIrLinker$KonanCachedLibraryModuleDeserializer.tryDeserializeIrSymbol(KonanIrlinker.kt:644)
18:28:11 	at org.jetbrains.kotlin.backend.common.serialization.BasicIrModuleDeserializer.deserializeIrSymbol(BasicIrModuleDeserializer.kt:111)
My read of the problem is the .klib descriptor only includes from the PSI model. So if I’m synthesizing new ones with IR, they’re not in the descriptor. Further details on my tracking bug.
I was able to work-around with a trick from @jw, pasting this into
gradle.properties
Copy code
# This is necessary to link Kotlin/Native targets. <https://github.com/cashapp/zipline/issues/751>
kotlin.native.cacheKind=none
Perhaps the step-by-step instructions in that tracking bug will help Kotlin/Native folks to eliminate this hack
p
Just for my own clarification, are these crashes happening in the compiler or the resulting binary?
We have similar issues in resulting binaries but not finding any of those specific symbols
j
This is a crash in the compiler.
It’s attempting to deserialize a klib, and failing because a symbol it expects to find isn’t there
The symbol is missing cause that part of the klib was encoded from PSI, not IR, and therefore lacks the effects of a compiler plugin