SuLG-ik / yandex-mapkit-kmp

Kotlin-first SDK for Yandex MapKit. It's API is similar to the Yandex MapKit SDK but also supports multiplatform projects and compose multiplaform, enabling you to use MapKit directly from your common source targeting iOS or Android.
https://ymk-kmp.sulgik.ru
Apache License 2.0
12 stars 1 forks source link

iOS build failed when use yandex-mapkit-kmp-compose:0.0.2 #7

Closed catron closed 3 weeks ago

catron commented 1 month ago

The error is reproduced on the sample project, when use implementation("ru.sulgik.mapkit:yandex-mapkit-kmp-compose:0.0.2")

error: org.jetbrains.kotlin.backend.konan.llvm.NativeCodeGeneratorException: Exception during generating code for following declaration: Inside: FILE fqName:ru.sulgik.mapkit.sample fileName:/Users/evgeniypavlov/ProjectsFolder/yandex-mapkit-kmp-main 2/sample/composeApp/src/commonMain/kotlin/ru/sulgik/mapkit/sample/Map.kt @Composable private fun MapScreen$lambda$8($mapController: YandexMapController, / var / $composer: Composer?, $changed: Int) { var $composer: Composer? = $composer when { when { areEqualByValue(first = $changed.and(other = 11).reinterpret<Int, Int>(), second = 2.reinterpret<Int, Int>()).not() -> true true -> $composer.().not() } -> { // BLOCK MapActions(mapController = $mapController, modifier = <get-$companion>().fillMaxWidth$default(fraction = // COMPOSITE { 0.0F.reinterpret<Float, Float>() // }, $mask0 = 1), $composer = $composer, $changed = 48.or(other = #ru_sulgik_mapkit_compose_YandexMapController$stable), $default = 0) } true -> $composer.skipToGroupEnd() } return theUnitInstance() }

SuLG-ik commented 1 month ago

Thanks, for your report. I reproduced this bug and find the solution. This is not a bug in my library, it's Kotlin 2.0 bug. You can track it here https://youtrack.jetbrains.com/issue/CMP-4809. Now, you can fix it by adding the following lines to your gradle.properties file:

kotlin.native.cacheKind=none
compose.kotlin.native.manageCacheKind=false

I keep your issue until this bug will not be fixed by stable Kotlin version or finding another way to fix it.