]> git.lizzy.rs Git - rust.git/commitdiff
OpenBSD has two stdc++ libraries: use the newer
authorSébastien Marie <semarie@users.noreply.github.com>
Sun, 18 Dec 2016 17:31:42 +0000 (18:31 +0100)
committerSébastien Marie <semarie@users.noreply.github.com>
Sun, 18 Dec 2016 17:43:05 +0000 (18:43 +0100)
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

index 50bc3e7b6243f8d8743cb0da1a07398724b918e2..86c40a0208ad340755cb3630c38378d93a177f7d 100644 (file)
@@ -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);
         }
     }
 }