Hello cross posting here since it seems to be a be...
# kotlin-native
m
Hello cross posting here since it seems to be a better channel for asking. The stack trace is the following
Copy code
e: Compilation failed: IrTypeAliasSymbol expected: Unbound public symbol for public kotlinx.coroutines/CancellationException|null[0]
 * Source files: 
 * Compiler version info: Konan: 1.5 / Kotlin: 1.5.0
 * Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: IrTypeAliasSymbol expected: Unbound public symbol for public kotlinx.coroutines/CancellationException|null[0]
https://kotlinlang.slack.com/archives/C3PQML5NU/p1620671651034400
s
Hello. Most likely, the reason for this exception is ABI-breaking change in kotlinx-coroutines 1.5.0-rc. Your project probably has a dependency that was built against older version of coroutines.
m
Thank you @sergey.bogolepov I’m not sure I know how to detect which library could cause that though. Is there an easy way to detect dependencies that breaks the binary compatibility?
s
Probably, the easiest way I am aware of is to run
./gradlew dependencies
and check that all versions of kotlinx-coroutines in direct and transitive dependencies are either 1.4.3 (and earlier) or 1.5.0-rc.
j
Seeing same issue here. I've forced use of in my case
1.5.0-native-mt
version and do see this for transitive dependencies....but I guess there could still be some in compatibility?
Copy code
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3-native-mt -> 1.5.0-native-mt
(latest version of
ktor
for example still depends on
1.4.3-native-mt
)
j
I'm having this same problem, using the latest ktor 1.5.4. Hopefully a new build with 1.5 will be out soon.
👍 1
s
@John O'Reilly, it's an binary incompatibility in newer version of coroutines. Ktor 1.5.4 klib depends on declaration that is declared in coroutines 1.4.3 (
CancellationException
as class), but missing in 1.5.0-rc (because
CancellationException
is now typealias to another declaration), so forcing dependency won't help here. Linker can't find "`CancellationException` as class" in the set of dependencies, because only one version of library (the latest one) is passed to the compiler from Gradle.
j
thanks @sergey.bogolepov, so just to clarify...we can't use current Ktor release with Kotlin 1.5 when using Kotlin/Native?
s
Honestly, I didn't check myself, so I don't know for sure. But if kotlinx-coroutines 1.4.3 are compatible with Kotlin 1.5 then you should be fine by sticking to that version of coroutines and Ktor 1.5.4.
j
ok, I think mistakenly thought you had to use kotlinx-coroutines 1.5 with Kotlin 1.5 (at least when using Kotlin/Native)
e
Using ktor 1.6.0 with kotlin 1.5.10 and kotlinx coroutines 1.5.0-native-mt leads to successful compilation for me at least 🙌