Skip to content

Commit

Permalink
Do not use the as-needed flag on macos.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Mar 11, 2023
1 parent c90ee79 commit ce48283
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
fn main() {
println!("cargo:rustc-link-arg=-Wl,--no-as-needed");
println!("cargo:rustc-link-arg=-Wl,--copy-dt-needed-entries");
println!("cargo:rustc-link-arg=-ltorch");
let os = std::env::var("CARGO_CFG_TARGET_OS").expect("Unable to get TARGET_OS");
match os.as_str() {
"linux" | "windows" => {
println!("cargo:rustc-link-arg=-Wl,--no-as-needed");
println!("cargo:rustc-link-arg=-Wl,--copy-dt-needed-entries");
println!("cargo:rustc-link-arg=-ltorch");
}
_ => {}
}
}

0 comments on commit ce48283

Please sign in to comment.