2

我在build.gradle.kts文件中添加了这样的标题:

linuxX64 {
    val main by compilations.getting
    main.cinterops.create("x11") {
        defFile("src/linuxX64Main/cinterop/x11.def")
        compilerOpts.add("-I" + rootDir.resolve("include"))
    }
}

库编译正常,并发布到 mavenLocal 很好,但是当其他一些项目将其添加为依赖项并运行链接器时,它会产生以下错误:

> Task :linkReleaseExecutableLinuxX64
e: C:\Users\Animesh\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1/bin/ld.lld invocation reported errors
The C:\Users\Animesh\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1/bin/ld.lld command returned non-zero exit code: 1.
output:
ld.lld: error: undefined symbol: XOpenDisplay
>>> referenced by out
>>>               C:\Users\Animesh\AppData\Local\Temp\konan_temp3813013133705122841\result.o:(kfun:com.github.animeshz.keyboard.X11KeyboardHandler#prepare(){})
ld.lld: error: undefined symbol: XPeekEvent
>>> referenced by out
>>>               C:\Users\Animesh\AppData\Local\Temp\konan_temp3813013133705122841\result.o:(kfun:com.github.animeshz.keyboard.X11KeyboardHandler#readEvents(){})
ld.lld: error: undefined symbol: XCloseDisplay
>>> referenced by out
>>>               C:\Users\Animesh\AppData\Local\Temp\konan_temp3813013133705122841\result.o:(kfun:com.github.animeshz.keyboard.X11KeyboardHandler#cleanup(){})
> Task :linkReleaseExecutableLinuxX64 FAILED

我们如何在要构建并发布到 maven 的库工件中包含一些 C-interop 标头/符号(目前在 mavenLocal 上进行测试)?

4

0 回答 0