You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows环境下Rust项目构建Kafka相关依赖失败的问题咨询

Windows环境下Rust项目构建Kafka相关依赖失败的问题咨询

我第一次尝试用Rust改写自己的现有代码,目标是做一个简单的UDP转Kafka生产者服务。

我的Cargo.toml依赖配置如下:

[dependencies]

dotenv = "0.15"
tokio = { version = "1", features = ["full"] }
uuid = { version = "1", features = ["v4"] }
chrono = "0.4"
kafka = "0.9"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

我在Windows系统上用Eclipse开发,每次构建都会遇到这个错误:

error: could not find native static library libssl, perhaps an -L flag is missing?

后来我换成librdkafka尝试解决,结果又碰到了新的报错:

error: failed to run custom build command for rdkafka-sys v4.7.0+2.3.0

Caused by:
  process didn't exit successfully: D:\technical\workspace-rust\tutorial-project\target\debug\build\rdkafka-sys-f9b1f42210c729af\build-script-build (exit code: 101)
  --- stdout
  Cloning librdkafka

  --- stderr
  Building and linking librdkafka statically
  Running command: "cp -a librdkafka/. D:\technical\workspace-rust\tutorial-project\target\debug\build\rdkafka-sys-aea7f213b861767e\out" in dir: .
  thread 'main' panicked at C:\Users\Bobby\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rdkafka-sys-4.7.0+2.3.0\build.rs:38:19:
  Command failed with error: program not found
  note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

我已经通过MSYS2安装了openssl这类必要的依赖,但问题还是没解决,有没有大佬能给点建议?

更新:我最后在自己的Windows笔记本上用VCPKG解决了这个问题!

备注:内容来源于stack exchange,提问作者Lynx777

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 09:08:11