diff --git a/quiche/deps/boringssl b/quiche/deps/boringssl index f1c75347da..6ab7c1482b 160000 --- a/quiche/deps/boringssl +++ b/quiche/deps/boringssl @@ -1 +1 @@ -Subproject commit f1c75347daa2ea81a941e953f2263e0a4d970c8d +Subproject commit 6ab7c1482bf4cdc91c87bc512aaf68ffb18975ec diff --git a/quiche/src/build.rs b/quiche/src/build.rs index e0e4fefeed..f509e49551 100644 --- a/quiche/src/build.rs +++ b/quiche/src/build.rs @@ -170,6 +170,27 @@ fn get_boringssl_cmake_config() -> cmake::Config { } } +/// Returns the C++ runtime library. +/// +/// This is required because BoringSSL requires linking to the C++ runtime. +fn get_cpp_runtime_lib() -> Option { + println!("cargo:rerun-if-env-changed=BORINGSSL_RUST_CPPLIB"); + + if let Ok(cpp_lib) = std::env::var("BORINGSSL_RUST_CPPLIB") { + return Some(cpp_lib); + } + + if std::env::var_os("CARGO_CFG_UNIX").is_some() { + match std::env::var("CARGO_CFG_TARGET_OS").unwrap().as_ref() { + "macos" => Some("c++".into()), + + _ => Some("stdc++".into()), + } + } else { + None + } +} + fn write_pkg_config() { use std::io::prelude::*; @@ -248,6 +269,10 @@ fn main() { .unwrap_or("static".to_string()); println!("cargo:rustc-link-lib={bssl_link_kind}=ssl"); println!("cargo:rustc-link-lib={bssl_link_kind}=crypto"); + + if let Some(cpp_lib) = get_cpp_runtime_lib() { + println!("cargo:rustc-link-lib={}", cpp_lib); + } } if cfg!(feature = "boringssl-boring-crate") {