-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build.rs: support libc++ Linux distros #81
Comments
Hi @Ella-0, thanks for the request. But unfortunately I at the moment won't have the bandwidth to work on this. Patches welcome!! :) |
The following fixes it. I would create a PR but I do not want to sign the CLA. diff --git a/shaderc-sys/build/build.rs b/shaderc-sys/build/build.rs
index 946309e..50f76ee 100644
--- a/shaderc-sys/build/build.rs
+++ b/shaderc-sys/build/build.rs
@@ -253,9 +253,13 @@ fn main() {
} {
match (target_os.as_str(), target_env.as_str()) {
("linux", _) => {
+ use std::process::Command;
println!("cargo:rustc-link-search=native={}", search_dir_str);
println!("cargo:rustc-link-lib={}={}", lib_kind, lib_name);
- println!("cargo:rustc-link-lib=dylib=stdc++");
+ match Command::new("cc").arg("-nostdlib").arg("-lstdc++").output() {
+ Ok(_) => println!("cargo:rustc-link-lib=dylib=stdc++"),
+ Err(_) => println!("cargo:rustc-link-lib=dylib=c++"),
+ }
return;
}
("windows", "msvc") => { |
I would recommend the link-cplusplus crate, which seems to be the defacto way of solving this issue in Rust crates. It's feature flags make it easy for end users to override, or, using overriding it in Cargo.toml |
Some Linux distros use LLVM libc++ instead of GNU libstdc++. Would support for this in build.rs be possible?
The text was updated successfully, but these errors were encountered: