0

In our project we use Kotlin Mobile Multiplatform and I was following this setup tutorial (https://codelabs.kmp.icerock.dev/codelabs/kmm-icerock-onboarding-1-en/#0) when I got stuck with a problem. Ive reached the point of Compilation of MultiPlatformLibrary.framework (Kotlin module for iOS) and got this error message on Android studio:

Compilation failed: /Users/rustem/.konan/kotlin-native-prebuilt-macos-1.5.21/konan/nativelib/8647638975372786697/libllvmstubs.dylib: dlopen(/Users/rustem/.konan/kotlin-native-prebuilt-macos-1.5.21/konan/nativelib/8647638975372786697/libllvmstubs.dylib, 1): no suitable image found.  Did find:

    /Users/rustem/.konan/kotlin-native-prebuilt-macos-1.5.21/konan/nativelib/8647638975372786697/libllvmstubs.dylib: mach-o, but wrong architecture

    /Users/rustem/.konan/kotlin-native-prebuilt-macos-1.5.21/konan/nativelib/8647638975372786697/libllvmstubs.dylib: mach-o, but wrong architecture

 * Source files: 

 * Compiler version info: Konan: 1.5.21 / Kotlin: 1.5.21

 * Output kind: FRAMEWORK

I've tried running ./gradlew syncMultiPlatformLibraryDebugFrameworkIosX64 command in both regular terminal and terminal opened using Rosetta. But it keeps telling me zsh: operation not permitted: ./gradlew

Russ
  • 53
  • 1
  • 9
  • 1
    update your kotlin version to 1.5.30, it has proper support for apple silicon – Phil Dukhov Sep 03 '21 at 12:59
  • @PhilipDukhov thank you so much for an answer, but it didn't help yet, do you have any other ideas? – Russ Sep 03 '21 at 13:11
  • 1
    `chmod +x gradlew` to make gradlew runnable. make sure you have arm version of android studio - it should have label "arm preview" on launch. Check which jdk is selected – Phil Dukhov Sep 03 '21 at 13:24
  • Hello, @Russ! How exactly did you change the mobile-moko-boilerplate to use 1.5.30? As far as I can see, it depends on a lot of third-party libraries and plugins, which might still be on 1.5.21. – Artyom Degtyarev Sep 03 '21 at 13:47
  • @PhilipDukhov awesome, it worked! I ran syncMultiPlatformLibraryDebugFrameworkIosX64 task though. Thank you so much! However now I have `Command PhaseScriptExecution failed with a nonzero exit code` issue in Xcode – Russ Sep 03 '21 at 13:48
  • @ArtyomDegtyarev I did it through Tools | Kotlin | Configure Kotlin Plugin Updates, it seem to work. Unfortunately that’s the only option I see right now – Russ Sep 03 '21 at 13:57
  • @Russ `Command PhaseScriptExecution failed with a nonzero exit code` is just says that script failed. You need to unfold it to see gradle output and the actual error – Phil Dukhov Sep 03 '21 at 14:09
  • @PhilipDukhov thank you will try once I get to work pc – Russ Sep 03 '21 at 14:40
  • @Russ, IIRC updating the IDE Plugin is not enough for this case. Per project, you utilize the Kotlin compiler version described in the Gradle plugin. See [doc](https://kotlinlang.org/docs/releases.html#update-to-a-new-release) and [this](https://stackoverflow.com/a/62374153/11533773) SO answer. I would also recommend you to reack IceRock(this template developers) directly somwhere like https://github.com/icerockdev/mobile-multiplatform-gradle-plugin and ask about Mac M1 support. – Artyom Degtyarev Sep 06 '21 at 10:06

0 Answers0