Would a Kotlin Native library (in KLib form) using...
# kotlin-native
n
Would a Kotlin Native library (in KLib form) using Kotlin 1.3.41 be compatible with a Kotlin Native program using Kotlin 1.3.50?
b
No. The ABI is unstable and the ABI version often changes each major release (and did in this case)
The current situation is that major version upgrades in your program have to be accompanied by similar upgrades for all of your libraries
n
In this particular case the version differences are minor. Do both the Kotlin Native library, and program have to use the same Kotlin version?
Is the Kotlin Native ABI going to be stable when the first stable version of Kotlin Native is released?
k
“Do both the Kotlin Native library, and program have to use the same Kotlin version?” Major, yes. Minor, no(t as much). 1.3.40 and 1.3.41 will match. 1.3.41 and 1.3.50 will not
“Is the Kotlin Native ABI going to be stable when the first stable version of Kotlin Native is released?” Well, Swift 5.1 is finally ABI stable, so we’ll see?
n
What has Swift ABI stability got to with Kotlin Native ABI stability?
k
Nothing?
n
Turns out a Kotlin Native library using Kotlin 1.3.41 is compatible with a Kotlin Native program using Kotlin 1.3.50. The main catch is the Gradle version used by the program needs to be compatible with the Gradle Metadata generated by the Kotlin Native library.
k
They’re not, though, or at least they shouldn’t be. You should be getting a compiler error from native. I would think, anyway?
n
Was seeing a Gradle metadata error at one stage.
k
That’s different. I’m talking about the native compiler. You should get an error. The gradle thing is just how it resolves the dependency. There are version issues there too, but they’re resolved as of 5.3-ish with metadata 1.0.
n
Now seeing the compiler error: The abi versions don't match. Expected '[14]', found '9'
k
Yeah, that. Was just going to paste mine (same, essentially)
n
Also seeing this message, which clarifies things even further: w: The compiler versions don't match either. Expected '[]', found '1.3.1-release-11173'
k
My project is on 1.3.50 and I switched to a 1.3.41 dep, and it failed. Moved it to the 1.3.50 and it compiled
Kotlin native had a different version number scheme before 1.3.50
n
What was the previous version scheme?
k
1.3.0 was 1.3.40, 1.3.1 was 1.3.41 (presumably). With 1.3.50 they aligned.
n
Makes sense.
Would it be prudent to make sure both the Kotlin Native library and program use the same Gradle version?
Eh, gradle version doesn’t matter as much after metadata 1.0, but it’s not a bad idea to have them on the same version. I try to do that. Now I generally use 5.4
n
Gradle 5.4.1 is a safe version to use for Kotlin Native projects.
k
Yeah, that’s a good one