Compiling Kotlin Coroutines dependency for different target Linux architecture

222 Views Asked by At

I was working on a Kotlin Native/Multiplatform project intended for linuxArm, using coroutines-core (1.4.21) but using the macosX64 target for development on my MacBook. I was devastated when I went to finally compile for linuxArm64 that Gradle spit a bunch of errors that was, basically, coroutines-core does not have linuxArmXX variants.

I had previously compiled and ran a project without coroutines for the linuxArm32 and linuxArm64 targets and ran the binaries successfully on my RPi 3 (linuxArm).

Roman Elizarov himself states that one can compile for an alternate architecture on a host machine from sources: Coroutines are not built for arm ( targets linuxArm32Hfp and others) #855

How does one do this? I have a basic understanding of Gradle and I can gcc a command line “helloworld”, but compiling an entire KN dependency from sources? Seems like alchemy.

1

There are 1 best solutions below

0
On

kotlinx.coroutines with linuxArm64 and linuxArm32Hfp

This fork has minimal changes to allow building linuxArm64 and linuxArm32Hfp kotlin native libraries.

Binaries are available on my maven repository at: https://h1.danbrough.org/maven

The current versions available are:

  • 1.5.2-danbroid
  • 1.5.2-danbroid-native-mt
  • 1.6.0-RC-danbroid

With the source code at: https://github.com/danbrough/kotlinx.coroutines and https://github.com/danbrough/kotlinx.atomicfu