While playing around with SDL2 on my Mac Studio M2...
# kotlin-native
k
While playing around with SDL2 on my Mac Studio M2 I found an odd issue where Gradle completely fails to run MacosArm64 executable via
runDebugExecutableMacosArm64
or
runReleaseExecutableMacosArm64
, it will flat-out reject it and skip the task. However, the executable has built fine and runs when ran manually? Is there something I'm doing wrong? I will share my code in thread Or is this a known issue?
Be it release or debug:
Copy code
> Task :checkKotlinGradlePluginConfigurationErrors
> Task :cinteropSdl2MacosArm64 UP-TO-DATE
> Task :compileKotlinMacosArm64 UP-TO-DATE
> Task :xcodeVersion UP-TO-DATE
> Task :linkReleaseExecutableMacosArm64 UP-TO-DATE
> Task :runReleaseExecutableMacosArm64 SKIPPED
It will be skipped. My
build.gradle.kts
looks like this:
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
    kotlin("multiplatform") version "2.0.0-Beta1"
}

group = "me.user"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

kotlin {

    linuxX64()
    macosX64()
    macosArm64()
    mingwX64()

    applyDefaultHierarchyTemplate()

    targets.withType<KotlinNativeTarget> {
        compilations["main"].cinterops {
            create("sdl2")
        }

        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }
}
And yes, project builds fine and executable runs fine, but the running of the file is skipped by gradle? Is this known issue on apple silicon? (Sorry if the build.gradle.kts looks like dogshit, I'm still confused about the hierarchical structure... But they stuff works... Sort of?)
c
Is it perhaps that you are running an x86_64 JVM on M2, hence various pieces don’t think they are on Arm64 and don’t run? You can print out
System.getProperty("os.arch")
to confirm.
k
Yeah after printing that out it seems it is x86_64, but I'm confused how that even. Thank you! I don't think I would ever realise this
👍 1
c
been there… cleanest to remove all JVMs and install just the ones you want, fresh. Likely some hold-over from migrating from Intel Mac. You’ll get a nice boost in performance too - running JVM under Rosetta is slow.