Skip to content

Commit 2c39ee1

Browse files
committed
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.
1 parent a7d9025 commit 2c39ee1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/librustc_llvm/build.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,25 @@ fn main() {
230230
}
231231
}
232232

233+
// OpenBSD has a particular C++ runtime library name
234+
let stdcppname = if target.contains("openbsd") {
235+
"estdc++"
236+
} else {
237+
"stdc++"
238+
};
239+
233240
// C++ runtime library
234241
if !target.contains("msvc") {
235242
if let Some(s) = env::var_os("LLVM_STATIC_STDCPP") {
236243
assert!(!cxxflags.contains("stdlib=libc++"));
237244
let path = PathBuf::from(s);
238245
println!("cargo:rustc-link-search=native={}",
239246
path.parent().unwrap().display());
240-
println!("cargo:rustc-link-lib=static=stdc++");
247+
println!("cargo:rustc-link-lib=static={}", stdcppname);
241248
} else if cxxflags.contains("stdlib=libc++") {
242249
println!("cargo:rustc-link-lib=c++");
243250
} else {
244-
println!("cargo:rustc-link-lib=stdc++");
251+
println!("cargo:rustc-link-lib={}", stdcppname);
245252
}
246253
}
247254
}

0 commit comments

Comments
 (0)