Hey Koders :v: I'm currently working on a fork of...
# compiler
d
Hey Koders ✌️ I'm currently working on a fork of the Kotlin compiler that supports running Kotlin/Native on an ESP32. You can check out my work so far here: https://github.com/BierDav/kotlin-konan But most problems I'm currently facing have a lot to do with my Windows for ARM development environment 🙃 Until now I always could easily add the
arm64
versions of the binaries such as Node, WASM, and so on. But now I'm a bit stuck with the usage of
kotlin-native-prebuilt
which currently doesn't have
arm64
versions for neither Linux or Windows Sooooo I was just wondering if someone of you could just add those two build targets to the build pipeline? I suppose this is not that big of a Hussle, because now we even have
arm64
windows Docker images. I would be really grateful for that 🙂 (I know, I can just build it myself and I will probably do that know, but in long term it would really make my life a whole lot easier and eventually)
d
Oh yeah thanks i upvoted those. I don't think that it would be that big of a deal to implement as a JetBrains employee has already pointed out: There are already free arm64 runners. But i don't wana blame you guys on this, you do a lot of great work. Maybe you could just tell me where the pipeline for those prebuilts is, maybe I can create a pull request then. I really need this 🙏
e
I don't work on it either, I'm waiting for those too
d
@svyatoslav.scherbina I saw that you have been assigned to a related issue. Could give me some rough overview or a starting point?
s
Could give me some rough overview or a starting point?
Do you mean a starting point for making the Kotlin/Native compiler run on Windows/arm64? Basically, you need to try building the compiler on a Windows/arm64 host, see what is missing/fails and fix this. There are some bigger parts though, like building LLVM and libffi for Windows/arm64.
d
My build of llvm for linux-arm64 is currently running, so far I encounter no issues, but we will see. By starting point, I mean the pipeline configuration, because when I fixed all of the potential issues I need the artifact hosted under:
Copy code
<https://download.jetbrains.com/kotlin/native/builds/releases/1.9.22/linux-aarch64/>
s
By starting point, I mean the pipeline configuration
What do you mean by the "pipeline"?
because when I fixed all of the potential issues I need the artifact hosted under:
Copy code
<https://download.jetbrains.com/kotlin/native/builds/releases/1.9.22/linux-aarch64/>
Usually you can override this and use artifacts "hosted" locally.
d
Is there no CI/CD pipline that builds those kotlin-native-prebuilt artifacts for each Kotlin release? I know that you can override, but that makes a very bad dev experience. My goal is to alter the configuration of the "script" that builds all of those hosted artifacts so that it also outputs the arm64 versions for windows and linux and not only for macos.
s
Is there no CI/CD pipline that builds those kotlin-native-prebuilt artifacts for each Kotlin release?
There is. Unfortunately, it is not open.
d
That's a bummer, are there any internal plans to update the pipeline? This is 1 hour of work max, and would help out all the people running arm64, because the fix for all the node js stuff is already in my Fork which i can make PR out of when I tested everything
s
are there any internal plans to update the pipeline?
What's the point in updating the CI pipeline if those "kotlin-native-prebuilt" artifacts can't be built on/for Windows/arm64 yet?
This is 1 hour of work max
I'm not so sure.
d
This is my current understanding after digging deep into the Kotlin/Native architecture: the core issue isn’t
kotlin-native-prebuilt
itself, but the
toolchainDependency
, which includes all the OS-specific files like headers. I tried to check that using ChatGPT (https://chatgpt.com/share/68716dcb-3bec-8005-b79d-a132386b97a7) For x64 and x86, this is a stripped-down MSYS2 toolchain. Since April, MSYS2 officially supports Windows ARM64 (link), so replicating the stripping process for ARM64 should mostly be a matter of copying the existing setup. That would produce something like
msys2-mingw-w64-arm64-2.zip
. With that toolchain in place, I can handle the changes in the Kotlin repo and build a custom
kotlin-native-prebuilt
. The main blocker is that the MSYS2 toolchain pipeline doesn’t seem to be public (unlike the Linux one, which can be found in
tools/toolchain-builder
). Given that ARM64 seems like an inevitable long-term target, this could be a good opportunity to accelerate support. Do you think it’s possible to allocate some resources toward this?
@svyatoslav.scherbina?
s
See also my response to you in the issue: https://youtrack.jetbrains.com/issue/KT-48420/Kotlin-Native-Support-win-arm64-host#focus=Comments-27-12435860.0-0
the core issue isn’t
kotlin-native-prebuilt
itself, but the
toolchainDependency
, which includes all the OS-specific files like headers.
Not quite correct. You need to build all compiler native dependencies for Windows ARM64, in particular LLVM and libffi.
Do you think it’s possible to allocate some resources toward this?
The harsh reality is that the Kotlin/Native compiler team at JetBrains is quite small and spread thin. The team backlog is stuffed with critical-priority projects. We can't really afford allocating any resources toward this at the moment. It is a good opportunity for the community to contribute.