cklib icon indicating copy to clipboard operation
cklib copied to clipboard

Crash when Konan classes aren’t downloaded yet

Open swankjesse opened this issue 4 years ago • 8 comments

I’m seeing this in CI for Zipline, and can reproduce locally by deleting my local Konan directory.

$ rm -rf ~/.konan/kotlin-native-prebuilt-*
$ ./gradlew build --stacktrace

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/jwilson/Projects/zipline/zipline/build.gradle.kts' line: 155

* What went wrong:
org.jetbrains.kotlin.konan.target.PlatformManager

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.ClassNotFoundException: org.jetbrains.kotlin.konan.target.PlatformManager
        at co.touchlab.cklib.gradle.reflection.PlatformManager.<init>(PlatformManager.kt:28)
        at co.touchlab.cklib.gradle.CKlibGradleExtensionKt.getPlatformManager(CKlibGradleExtension.kt:28)
        at co.touchlab.cklib.gradle.CompileToBitcodeExtension.create(CompileToBitcodeExtension.kt:33)
        at co.touchlab.cklib.gradle.CompileToBitcodeExtension.create$default(CompileToBitcodeExtension.kt:24)
        at Build_gradle$2.execute(build.gradle.kts:155)
        at Build_gradle$2.execute(build.gradle.kts:6)

swankjesse avatar Jan 04 '22 03:01 swankjesse

Still running into this on fresh clones of zipline.

veyndan avatar Jan 18 '22 14:01 veyndan

Anybody know if this is still happening in zipline? I did a clean clone build with the deleted local konan dir and it didn't crash.

It's still an issue with the library, I'm sure. We're assuming kotlin native has been downloaded already. I want to see if there's a way to get the download to happen before we need it, or to just ship the jar with cklib. The issue is that we're using a jar that kotlin native doesn't post as it's own dependency, so we can't just add it to the gradle config. It also may be feasible to delay calling it until after task config. Looking at it now, but if the builds aren't failing, it's a different priority.

kpgalligan avatar Feb 07 '22 16:02 kpgalligan

I’m setting up a new workstation tomorrow; I’ll post an update here either way.

swankjesse avatar Feb 09 '22 04:02 swankjesse

Any particular branch in zipline? I've been trying jwilson.0105.kt_16, assuming that's the config that will be in place for 1.6.10.

kpgalligan avatar Feb 09 '22 15:02 kpgalligan

I ran into this today:

java.lang.ClassNotFoundException: org.jetbrains.kotlin.konan.target.PlatformManager
	at co.touchlab.cklib.gradle.reflection.PlatformManager.<init>(PlatformManager.kt:28)
	at co.touchlab.cklib.gradle.CKlibGradleExtensionKt.getPlatformManager(CKlibGradleExtension.kt:28)
	at co.touchlab.cklib.gradle.CompileToBitcodeExtension.create(CompileToBitcodeExtension.kt:33)
	at co.touchlab.cklib.gradle.CompileToBitcodeExtension.create$default(CompileToBitcodeExtension.kt:24)
	at Build_gradle$2.execute(build.gradle.kts:155)

adrw avatar Feb 09 '22 19:02 adrw

This happens when Zipline is the first KMM project you set up.

adrw avatar Feb 09 '22 19:02 adrw

We get the same crash on all cklib releases preceding 0.2.4 because the host architecture was hardcoded to x86_64.

https://github.com/touchlab/cklib/blame/9377d335a18c030d06b3fae2d9f063fec7646398/plugin/src/main/kotlin/co/touchlab/cklib/gradle/CKlibGradleExtension.kt

Fix is to upgrade to 0.2.4 or newer, which has the caveat of requiring Kotlin 1.6.

swankjesse avatar Feb 10 '22 18:02 swankjesse