Kotlin 多平台 Ktor linux 编译错误:无法找到库 -lcurl

问题描述

我正在尝试使用具有 Ktor 依赖项的 Kotlin 多平台项目为 Linux 构建本机二进制文件。但是,当我运行任务 nativeBinaries 时,出现以下错误

e: /Users/<user>/.konan/dependencies/clang-llvm-apple-8.0.0-darwin-macos/bin/ld.lld invocation reported errors

The /Users/<user>/.konan/dependencies/clang-llvm-apple-8.0.0-darwin-macos/bin/ld.lld command returned non-zero exit code: 1.
output:
ld.lld: error: unable to find library -lcurl

该项目是一个简单的项目,具有以下依赖项

        val commonMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-core:1.5.4")
            }
        }
        val nativeMain by getting {
            dependencies {
                implementation ("io.ktor:ktor-client-curl:1.5.4")
            }
        }

如果我从 nativeMain删除 ktor 客户端 curl 依赖项,它会成功构建。 我在本地环境中安装了 curl(我使用的是 mac),我错过了什么吗?我是否需要进行任何其他配置才能消除此错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)