https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
j

Justin

03/27/2023, 6:53 AM
Can anyone help me further? I want to create a CLI tool in Kotlin-native and use in from Docker. Locally on my mac I can build and use the tool but I get problems when I build it with Docker. On my M1 Mac I get:
Copy code
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find :kotlin-native-prebuilt-linux-aarch64:1.8.0.
Searched in the following locations:
   - <https://download.jetbrains.com/kotlin/native/builds/releases/1.8.0/linux-aarch64/kotlin-native-prebuilt-linux-aarch64-1.8.0.tar.gz>
I test it with a basic hallo world native application. Changed the
build.gradle.kts
to support my M1:
Copy code
...
kotlin {
    val hostOs = System.getProperty("os.name")
    val arch = System.getProperty("os.arch")
    val isMingwX64 = hostOs.startsWith("Windows")
    val nativeTarget = when {
        hostOs == "Mac OS X" && arch == "aarch64" -> macosArm64("native")
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" && arch == "aarch64" -> linuxArm64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
    }
Dockerfile
Copy code
FROM gradle:8-jdk17-focal AS builder
COPY . /app
WORKDIR /app
RUN gradle build --warning-mode summary --stacktrace --scan

FROM ubuntu:focal
COPY --from=builder /app/build/bin/native/releaseExecutable ./
CMD ["./clean-native.kexe"]
It looks like the on the latest release linux-aarch64 does not exist. Is this possible and how could I do this?
34 Views