Windows10下用MinGW/MSYS2编译MongoDB驱动时缺失依赖库问题
Rust MongoDB项目编译失败:缺失ADX指令相关ring依赖库
编译环境:Windows 10,使用MSYS2提供的gcc/x86_64-w64-mingw32/14.2.0工具链
编译失败原因:依赖包需要引用ring_core_0_17_8_fiat_curve25519_adx_mul和ring_core_0_17_8_fiat_curve25519_adx_square两个库,但编译时无法找到这两个库。
相关代码文件
task_process.rs
mod queues_mongo; use queues_mongo::email_queue::search_queue; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let _ = search_queue().await; Ok(()) }
email_queue.rs
extern crate dotenv; use dotenv::dotenv; use std::env; use mongodb::{ bson::{doc, Document}, error, Client, Collection, Database, }; #[allow(dead_code)] pub async fn search_queue() -> error::Result<()> { dotenv().ok(); let uri: String = env::var("MONGO_URI").expect("MONGO_URI"); let db: String = env::var("MONGO_DATABASE").expect("MONGO_DATABASE"); let client: Client = Client::with_uri_str(uri).await?; let database: Database = client.database(db.as_str()); let collection: Collection = database.collection("emails"); let email: Option = collection.find_one(doc! { "status": "Sent" }).await?; println!("Found a email:\n{:#?}", email); Ok(()) }
Cargo.toml
[package] name = "rustlang-course" version = "0.1.0" edition = "2021" [dependencies] aead = "0.5.2" axum = "0.8.1" base64 = "0.22.1" bson = "2.13.0" chrono = "0.4.39" colored = "2.1.0" csv = "1.3.1" dotenv = "0.15.0" futures = "0.3.31" hex = "0.4.3" mongodb = "3.1.1" notify = "7.0.0" notify-debouncer-full = "0.4.0" notify-debouncer-mini = "0.5.0" openssl = "0.10.68" prost = "0.13.3" rand = "0.8.5" regex = "1.11.1" reqwest = { version = "0.12.9", features = ["json"] } roxmltree = "0.20.0" serde = "1.0.214" serde_json = "1.0.133" sqlx = "0.8.2" tokio = { version = "1.41.0", features = ["full"] } tonic = "0.12.3" uuid = "1.11.0" [build-dependencies] cc = "1.2.7" tonic-build = "0.12.3" [[bin]] name = "task_process" path = "src/task_process.rs"
补充说明
完整编译错误信息包含上述两个库未找到的链接错误。
内容的提问来源于stack exchange,提问作者apetitflores
相关产品推荐
相关产品推荐

