Skip to content

Commit

Permalink
fix linking with libc++abi on darwin with recent llvm
Browse files Browse the repository at this point in the history
  • Loading branch information
symphorien committed Dec 19, 2023
1 parent 61c8399 commit ae965de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{path::PathBuf, ffi::OsString};
// SPDX-License-Identifier: LGPL-3.0

fn v(s: &str) -> versions::Versioning {
Expand Down Expand Up @@ -51,6 +51,12 @@ fn main() {
};
eprintln!("building with NIXVER={version}");
builder.define("NIXVER", version.to_string().as_str());
let compiler = builder.get_compiler();
let compile_args = compiler.args();
if compile_args.contains(&OsString::from("-lc++")) {
// required for exception handlind with libc++
println!("cargo:rustc-link-lib=c++abi");
}
builder.compile("libnix_adapter.a");

let bindings = bindgen::Builder::default()
Expand Down

0 comments on commit ae965de

Please sign in to comment.