c

    Casey Brooks

    2 years ago
    Has anyone successfully upgraded to 1.3.60 and compiled an iOS library? On 1.3.50, my project worked fine, but in 1.3.60 I get an error on the
    linkFramework
    tasks:
    Task :linkMobileSharedDebugFrameworkIos
    e: Compilation failed: org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor@21f27bb5 is not bound
    
     * Source files:
     * Compiler version info: Konan: 1.3.60 / Kotlin: 1.3.60
     * Output kind: FRAMEWORK
    
    e: java.lang.IllegalStateException: org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor@21f27bb5 is not bound
            at org.jetbrains.kotlin.backend.common.descriptors.WrappedDeclarationDescriptor.getOwner(WrappedDescriptors.kt:98)
            at org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor.getReturnType(WrappedDescriptors.kt:816)
            ...
    Here’s my Gradle script, nothing too special about it. The only thing I changed is the Kotlin version (
    1.3.50
    ->
    1.3.60
    ), and the serialization runtime library version (
    0.12
    ->
    0.14
    )
    import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
    import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
    
    plugins {
        kotlin("multiplatform") version "1.3.60"
        id("kotlinx-serialization") version "1.3.60"
    }
    
    repositories {
        jcenter()
        maven(url = "<https://kotlin.bintray.com/kotlinx>")
    }
    
    group = "com.example.group"
    version = "1.0.0"
    
    val moduleName = "MobileShared"
    
    kotlin {
        jvm()
    
        val iosArm64 = iosArm64("ios")
        val iosX64 = iosX64("iosSim")
    
        configure(listOf(iosArm64, iosX64)) {
            binaries {
                framework(moduleName)
            }
        }
    
        sourceSets {
            val serializationVersion = "0.14.0"
    
            all {
                languageSettings.apply {
                    useExperimentalAnnotation("kotlin.Experimental")
                }
            }
    
            // Common Sourcesets
            val commonMain by getting {
                this.kotlin.srcDir("${project.rootDir}/generated-src")
    
                dependencies {
                    implementation(kotlin("stdlib-common"))
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
                }
            }
            val commonTest by getting {
                dependencies {
                    implementation(kotlin("test-common"))
                    implementation(kotlin("test-annotations-common"))
                }
            }
    
            // JVM Sourcesets
            val jvmMain by getting {
                dependencies {
                    implementation(kotlin("stdlib-jdk7"))
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion")
                }
            }
            val jvmTest by getting {
                dependencies {
                    implementation(kotlin("test"))
                    implementation(kotlin("test-junit"))
                }
            }
    
            // iOS Sourcesets
            val iosMain by getting {
                dependencies {
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serializationVersion")
                }
            }
            val iosSimMain by getting {
                dependsOn(iosMain)
            }
        }
    
        tasks {
            NativeBuildType.DEFAULT_BUILD_TYPES.forEach { releaseType ->
                // Builds a 'fat' binary framework by combining the original arm64 and x64 iOS libraries
                // into a single library in the exported framework folder
                create("${releaseType.name.toLowerCase()}FatFramework", FatFrameworkTask::class) {
                    // The fat framework must have the same base name as the initial frameworks.
                    baseName = moduleName
    
                    // The default destination directory is '<build directory>/fat-framework'.
                    destinationDir = buildDir.resolve("fat-framework/${releaseType.name.toLowerCase()}")
    
                    // Specify the frameworks to be merged.
                    from(
                        iosArm64.binaries.getFramework(moduleName, releaseType),
                        iosX64.binaries.getFramework(moduleName, releaseType)
                    )
                }
            }
    
            val makeFatFrameworks by creating {
                NativeBuildType.DEFAULT_BUILD_TYPES.forEach { releaseType ->
                    dependsOn("${releaseType.name.toLowerCase()}FatFramework")
                }
            }
    
            val iosTest by creating {
                iosX64.name
    
                val device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
                dependsOn("linkDebugTest${iosX64.name.capitalize()}")
                shouldRunAfter("jvmTest")
    
                group = JavaBasePlugin.VERIFICATION_GROUP
                description = "Runs tests for target '${iosX64.name}' on an iOS simulator"
    
                doLast {
                    exec {
                        val testBinaryPath = iosX64
                            .binaries
                            .getTest(NativeBuildType.DEBUG)
                            .outputFile
                            .absolutePath
    
                        commandLine = listOf("xcrun", "simctl", "spawn", "--standalone", device, testBinaryPath)
                    }
                }
            }
    
            "check" {
                dependsOn(iosTest)
            }
        }
    }
    s

    Sam Schilling

    2 years ago
    Upgrading broke mine as well, but with a different error
    Artyom Degtyarev [JB]

    Artyom Degtyarev [JB]

    2 years ago
    Hi @Casey Brooks! Can you share a complete stack trace, please? It would help a lot.
    c

    Casey Brooks

    2 years ago
    Sure. I can also put together a sample repo if you want. And I’m running on a 2017 MacBook Pro on Mojave, with the latest version of XCode (11.2.1)
    ./gradlew clean build
    
    > Configure project :
    Kotlin Multiplatform Projects are an experimental feature.
    
    > Task :linkMobileSharedDebugFrameworkIos
    e: Compilation failed: org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor@21f27bb5 is not bound
    
     * Source files:
     * Compiler version info: Konan: 1.3.60 / Kotlin: 1.3.60
     * Output kind: FRAMEWORK
    
    e: java.lang.IllegalStateException: org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor@21f27bb5 is not bound
            at org.jetbrains.kotlin.backend.common.descriptors.WrappedDeclarationDescriptor.getOwner(WrappedDescriptors.kt:98)
            at org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor.getReturnType(WrappedDescriptors.kt:816)
            at org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor.getType(WrappedDescriptors.kt:820)
            at org.jetbrains.kotlin.ir.util.DeclarationStubGenerator.generateFieldStub(DeclarationStubGenerator.kt:140)
            at org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator.generateUnboundSymbolsAsDependencies(ExternalDependenciesGenerator.kt:59)
            at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateUnboundSymbolsAsDependencies(ModuleGenerator.kt:63)
            at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:82)
            at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:175)
            at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt)
            at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:115)
            at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:113)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:128)
            at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:24)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:127)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:105)
            at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:28)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:128)
            at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:24)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:127)
            at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:105)
            at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:42)
            at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:27)
            at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:74)
            at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:34)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:82)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:50)
            at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:215)
            at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:207)
            at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:225)
            at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:222)
            at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:27)
            at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:21)
            at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:224)
            at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:304)
            at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:16)
    
    
    > Task :linkMobileSharedDebugFrameworkIos FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':linkMobileSharedDebugFrameworkIos'.
    > Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    BUILD FAILED in 1m 12s
    7 actionable tasks: 7 executed
    @Artyom Degtyarev [JB] Here’s a sample repo which reproduces the crash. Having
    @Serializable
    on an
    open class
    seems to be the culprit.
    Artyom Degtyarev [JB]

    Artyom Degtyarev [JB]

    2 years ago
    It seems like a bug in the kotlinx.serialization. There is a similar issue there(https://github.com/Kotlin/kotlinx.serialization/issues/612), the problem in both cases is looking to be the same. The best I can recommend for now is just to wait until it will be fixed🙁. Anyway, thanks for such a detailed report!