Skip to content

Commit cc976b2

Browse files
cyccbxhlhuanjin.cb
authored andcommitted
Tested successfully on MAC as well.
1 parent 51e606a commit cc976b2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

xgboost-sys/build.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ fn main() {
3333
#[cfg(not(feature = "cuda"))]
3434
let mut dst = Config::new(&xgb_root);
3535

36-
let dst = dst.uses_cxx11()
36+
#[allow(unused_mut)]
37+
let mut dst = dst.uses_cxx11()
3738
.define("BUILD_STATIC_LIB", "ON");
3839

3940
#[cfg(target_os = "macos")]
@@ -54,16 +55,12 @@ fn main() {
5455

5556
let bindings = bindgen::Builder::default()
5657
.header("wrapper.h")
58+
.blocklist_item("std::__1.*")
5759
.clang_args(&["-x", "c++", "-std=c++11"])
5860
.clang_arg(format!("-I{}", xgb_root.join("include").display()))
5961
.clang_arg(format!("-I{}", xgb_root.join("rabit/include").display()))
6062
.clang_arg(format!("-I{}", xgb_root.join("dmlc-core/include").display()));
6163

62-
#[cfg(target_os = "linux")]
63-
let bindings = bindings
64-
.clang_arg(format!("-I/usr/include/c++/11"))
65-
.clang_arg(format!("-I/usr/include/x86_64-linux-gnu/c++/11"));
66-
6764
#[cfg(feature = "cuda")]
6865
let bindings = bindings.clang_arg("-I/usr/local/cuda/include");
6966
let bindings = bindings
@@ -83,6 +80,7 @@ fn main() {
8380
// link to appropriate C++ lib
8481
if target.contains("apple") {
8582
println!("cargo:rustc-link-lib=c++");
83+
println!("cargo:rustc-link-search=native=/opt/homebrew/opt/libomp/lib");
8684
println!("cargo:rustc-link-lib=dylib=omp");
8785
} else {
8886
println!("cargo:rustc-cxxflags=-std=c++17");

0 commit comments

Comments
 (0)