diff --git a/src/rust/cryptography-openssl/build.rs b/src/rust/cryptography-openssl/build.rs index 00e1df1326d1..4f66b4970644 100644 --- a/src/rust/cryptography-openssl/build.rs +++ b/src/rust/cryptography-openssl/build.rs @@ -28,6 +28,11 @@ fn main() { if env::var("DEP_OPENSSL_BORINGSSL").is_ok() { println!("cargo:rustc-cfg=CRYPTOGRAPHY_IS_BORINGSSL"); - println!("cargo:rustc-link-lib=stdc++"); + if env::var_os("CARGO_CFG_UNIX").is_some() { + match env::var("CARGO_CFG_TARGET_OS").as_deref() { + Ok("macos") => println!("cargo:rustc-link-lib=c++"), + _ => println!("cargo:rustc-link-lib=stdc++"), + } + } } }