Is it really not possible to use Kotlin/Native to ...
# general-advice
s
Is it really not possible to use Kotlin/Native to compile to and execute
windows-x86_64
on Windows 11 ARM 64?! Is there anyway I can 'override' a property to allow this?
build.gradle.kts
Copy code
plugins {
    kotlin("multiplatform") version "2.2.20" // "2.0.0"
}

repositories {
    mavenCentral()
}

kotlin {

    // windows
    mingwX64("native") {
        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }

    sourceSets {
        val nativeMain by getting
    }
}
Error:
Copy code
Execution failed for task ':commonizeNativeDistribution'.
> Could not isolate value org.jetbrains.kotlin.gradle.targets.native.toolchain.NativeVersionValueSource$Params_Decorated@26bb7cb5 of type NativeVersionValueSource.Params
   > Could not resolve all files for configuration ':kotlinNativeBundleConfiguration'.
      > Failed to transform kotlin-native-prebuilt-2.2.20-windows-aarch64.zip (org.jetbrains.kotlin:kotlin-native-prebuilt:2.2.20) to match attributes {artifactType=zip, kotlin.native.bundle.type=DIRECTORY, org.gradle.status=release}.
         > Could not find kotlin-native-prebuilt-2.2.20-windows-aarch64.zip (org.jetbrains.kotlin:kotlin-native-prebuilt:2.2.20).
           Searched in the following locations:
               <https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-native-prebuilt/2.2.20/kotlin-native-prebuilt-2.2.20-windows-aarch64.zip>

Possible solution:
 - Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
References: • https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-native-prebuilt/2.2.20/https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#supported-platformshttps://youtrack.jetbrains.com/issue/KT-68504/Kotlin-Native-mingwArm64-target-supporthttps://youtrack.jetbrains.com/issue/KT-48420/Kotlin-Native-Support-win-arm64-host
e
the toolchain simply doesn't exist, you can't override it with a property
I don't have access to Windows (on ARM or otherwise) but I believe it has the ability to run x86 programs through emulation. you can try running Gradle build with an x86 JVM, which should cause the Kotlin Gradle Plugin to detect x86 and use the toolchain for x86 Windows
1
s
Thank you @ephemient 🙏 Yes Windows on ARM can run x86 programs, I will try this out