关于linux:为什么Gradle在我的Kotlin跨平台项目中的:linkDebugTestLinux上失败?

Why is Gradle failing on :linkDebugTestLinux in my Kotlin multiplatform project?

我正在将C#库移植到Kotlin以利用多平台的优势。运行build任务时,它在子任务linkDebugTestLinux中失败。

对于上下文,我正在Manjaro上使用IDEA Ultimate。我确定我的代码没有问题,因为compileKotlinLinux正确无误地完成了。

" linkDebugTestLinux "的DDG结果为零,对于" konan找不到家"或" kotlin本机... "没有任何帮助。经过数小时将官方文档中不完整和过时的示例拼接在一起,我已经放弃了。

我的build.gradle.kts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
plugins {
    kotlin("multiplatform") version"1.3.40"
}

repositories {
    mavenCentral()
}

dependencies {
    commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib")
    commonTestImplementation("org.jetbrains.kotlin:kotlin-test-common")
    commonTestImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common")
}

kotlin {
//  js() // wasn't the issue
    linuxX64("linux")
}

不带参数的任务build的输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
> Configure project :
Kotlin Multiplatform Projects are an experimental feature.
> Task :compileKotlinLinux
[...unused param warnings...]
> Task :compileKotlinMetadata
[...unused param warnings...]
> Task :metadataMainClasses
> Task :metadataJar
> Task :assemble
> Task :linuxProcessResources NO-SOURCE
> Task :linuxMainKlibrary
> Task :linkDebugTestLinux FAILED
e: Could not find"/home/username/" in [/home/username/path/to/the/repo, /home/username/.konan/klib, /home/username/.konan/kotlin-native-linux-1.3/klib/common, /home/username/.konan/kotlin-native-linux-1.3/klib/platform/linux_x64].
[...snip...]
BUILD FAILED in 16s
4 actionable tasks: 4 executed
Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1

在样板中,我省略了建议使用--debug的建议,因此我已将其上传到此处。


经过一番调查,我们认为问题出在路径上。在调试日志中,您获得了/home/yoshi/,/片段。只要此目录名是意外的,编译器就会将此,解释为lib名称之间的分隔符。因此,它试图找到显然不可用的库/home/yoshi/
现在,我建议您将目录名称更改为琐碎的内容。