Search code examples
kotlincocoapodskotlin-multiplatform-mobile

Kotlin MPP pod integration fails


I just released a first version of my Kotlin MPP as a library 3 days ago. It was integrated on Android and iOS successfully. After the first released I switched to a coworkers branch and invalidated my caches. Since then I am not able to sync gradle anymore.

I'm getting this error:

Task :cinteropSnowplowTrackerIosArm64 Exception in thread "main" java.lang.Error: /var/folders/gv/rc4dmzjs3wj9kt4kr00nwhdw0000gn/T/13496315139908854548.m:1:9: fatal error: could not build module 'SnowplowTracker' at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152) at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:68) at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:14) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:515) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:266) at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:76) at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45) at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:38) at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:60)

Even after going back to my very first POC commits, which was successfully published several times I am not able to build anymore. Here is how I integrated the iOS dependency. I don't have any idea what the issue is. I tried setting a whole bunch of different JDK versions (8, 11, 14, 15, 16, 17) without success. I tried upgrading Kotlin version from 1.4.20 to 1.5.x. I tried downgrading IntelliJ IDEA and many more things all without success. The only guess I have right now is that it is related to some plugin updated. How could I verify that?

Here is how the pod is integrated:

   cocoapods {
    ios.deploymentTarget = "12"
    summary = "Kaia tracking library"
    homepage = "https://github.com/KaiaHealth/kaia-tracking-library"
    authors = company

    pod("SnowplowTracker") {
        version = "~> 1.2.0"
    }
}

Solution

  • With credits to xoif as he answered this on youtrack. The problem seems to be xcode command line tools 13 and the solution is to downgrade:

    1. Download Xcode 12.5
    2. Select Xcode 12.5.1 as default Command Line Tool (in Xcode -> Preferences -> Locations)
    3. cinterop should work again.