From 2c39ee12a99f9548a5e379e8bcea4f7923028fee Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Marie?= Date: Sun, 18 Dec 2016 18:31:42 +0100 Subject: [PATCH] OpenBSD has two stdc++ libraries: use the newer stdc++ is from base, and is an old library (GCC 4.2) estdc++ is from ports, and is a recent library (GCC 4.9 currently) as LLVM requires the newer version, use it if under OpenBSD. --- src/librustc_llvm/build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 50bc3e7b624..86c40a0208a 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -230,6 +230,13 @@ fn main() { } } + // OpenBSD has a particular C++ runtime library name + let stdcppname = if target.contains("openbsd") { + "estdc++" + } else { + "stdc++" + }; + // C++ runtime library if !target.contains("msvc") { if let Some(s) = env::var_os("LLVM_STATIC_STDCPP") { @@ -237,11 +244,11 @@ fn main() { let path = PathBuf::from(s); println!("cargo:rustc-link-search=native={}", path.parent().unwrap().display()); - println!("cargo:rustc-link-lib=static=stdc++"); + println!("cargo:rustc-link-lib=static={}", stdcppname); } else if cxxflags.contains("stdlib=libc++") { println!("cargo:rustc-link-lib=c++"); } else { - println!("cargo:rustc-link-lib=stdc++"); + println!("cargo:rustc-link-lib={}", stdcppname); } } } -- 2.44.0