diff --git a/openssl-sys/build/main.rs b/openssl-sys/build/main.rs index be4c21436..5ad2eda7a 100644 --- a/openssl-sys/build/main.rs +++ b/openssl-sys/build/main.rs @@ -207,13 +207,17 @@ fn main() { } // https://github.com/openssl/openssl/pull/15086 + // Embrace the atomic capability library across various platforms. + // For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a + // while some use libatomic.a, and others use libatomic_ops.a. + let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned()); if version == Version::Openssl3xx && kind == "static" && (env::var("CARGO_CFG_TARGET_OS").unwrap() == "linux" || env::var("CARGO_CFG_TARGET_OS").unwrap() == "android") && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32" { - println!("cargo:rustc-link-lib=atomic"); + println!("cargo:rustc-link-lib={}", atomic_name); } if kind == "static" && target.contains("windows") {