Home > Mobile >  Build M1 binary for Kotlin Native in IntelliJ IDEA
Build M1 binary for Kotlin Native in IntelliJ IDEA

Time:12-18

I'm playing with Kotlin Native on my M1 Mac using IntelliJ IDEA 2022.3 Community Edition. (Build #IC-223.7571.182, built on November 29, 2022; Runtime version: 17.0.5 1-b653.14 aarch64)

I noticed that the resulting binaries are for x86_64

I can't find in the settings, the IDEA help, or Google how to get it to build for aarch64.

Is it missing or am I just not finding the setting?

The Kotlin Compiler page of my project settings

CodePudding user response:

I still have not found a way to set this via the GUI and I don't have a Java, Kotlin, Gradle, or JetBrains background, but I found out how to change it in the configuration files for now:

Project and editor tabs for the fix

In the project tab I can edit build.gradle.kts and change the kotlin/nativeTarget/hostOS line:

Was:

hostOs == "Mac OS X" -> macosX64("native")

Now:

hostOs == "Mac OS X" -> macosArm64("native")

Thanks to the help of this post on YouTrack from a month ago: New Kotlin Multiplatform Native Application project template won't run on Apple M1 from IntelliJ IDEA

  • Related