kotlinx-benchmark icon indicating copy to clipboard operation
kotlinx-benchmark copied to clipboard

K/N: can't define cinterop in a benchmark module

Open fzhinkin opened this issue 1 year ago • 0 comments
trafficstars

Benchmark compilation fails when a module has cinterop configuration for a native target.

Here's an example project: https://github.com/fzhinkin/kotlinx-benchmark-cinterop-issue/blob/main/build.gradle.kts

Compilation fails with:

> Task :compileMacosArm64BenchmarkKotlinMacosArm64 FAILED
e: Could not find "org.example:kotlinx-benchmark-cinterop-issue-cinterop-nativeCalls" in [/XXX/Development/kotlinx-benchmark-cinterop-issue, /XXX/.konan/klib, /XXX/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/common, /XXX/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/platform/macos_arm64]

Sometimes, a good reference for benchmarking is some native library, so it would be nice to support cinterop for benchmark modules (or at least, explicitly warn that it's unsupported).

The workaround is to declare a separate module with cinterop and depend on it.

fzhinkin avatar Feb 15 '24 10:02 fzhinkin