Skip to content

Kotlin/Native on macOS, Linux and Windows; GraalVM by default - #8

Merged
kdroidFilter merged 4 commits into
mainfrom
feat/kn-desktop
Nov 16, 2026
Merged

kdroidFilter merged 4 commits into
mainfrom
feat/kn-desktop

Conversation

@kdroidFilter

Copy link
Copy Markdown
Contributor

What

  • Kotlin/Native desktop targets: macosArm64, macosX64, linuxX64, linuxArm64, mingwX64. One transport for every Kotlin/Native target (nativeMain): JNI, or a native image's entry points. On the desktop the runtime is loaded from nja/ next to the executable (or NJA_HOME):
    • GRAALVM: a shared library built by the host's native-image --shared (libnja.dylib, libnja.so, nja.dll): no kit needed;
    • JVM: a JDK's libjvm, from nja/runtime or JAVA_HOME.
      Binaries don't link the runtime, so they still cross-compile; an image builds on its own host only (a warning says so otherwise).
  • GraalVM by default on every platform. Android keeps the JVM on a non-Linux host unless androidRuntime is set (an Android image builds on Linux only).
  • Plugin: desktopRuntime, graalvmRelease; GraalVM CE on Windows hosts (zip, native-image.cmd, no symbolic links).
  • Server: buffers are freed by the side that allocated them (on Windows the image's C runtime isn't the app's): nja_graal_free, and a release function given with the upcall. GraalLink drops StackValue (it throws on virtual threads). IosLink becomes JniLink.
  • CI: test-desktop.yml, both runtimes on macOS, Linux x64/arm64 and Windows.
  • README rewritten around the platforms × runtimes matrix.

Tested locally

  • macosArm64Test: 2,008/2,008 with GraalVM, 2,008/2,008 with the JVM.
  • iosSimulatorArm64Test (GraalVM, the new default): 2,008/2,008.
  • Linux and Windows: compiled (klibs and test binaries) from macOS; this PR's CI runs them.

The native transport (JNI or a native image's entry points) is shared by every
Kotlin/Native target. On the desktop the runtime is loaded from nja/ next to the
executable (or NJA_HOME): the facades' native image, a shared library built by
the host's native-image, or a JDK's libjvm. GRAALVM is the default runtime
everywhere (Android keeps the JVM on non-Linux hosts unless set). Buffers are
freed by the side that allocated them (Windows' C runtimes differ); GraalLink
drops StackValue (virtual threads); IosLink becomes JniLink. README rewritten.
Kotlin PSI wants \n: a façade checked out on Windows (\r\n) lost members in the
generated client. Kotlin/Native doesn't run on Linux arm64 hosts: CI links
linuxArm64's tests on Linux x64, and the README says how its image ships.
@kdroidFilter
kdroidFilter merged commit 0b75619 into main Nov 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant