use std::env::const::ARCH

This commit is contained in:
Morgan Funtowicz 2024-07-25 10:44:42 +00:00
parent fcbf2fc1ac
commit 69a5804e51

View File

@ -1,4 +1,5 @@
use std::env; use std::env;
use std::env::consts::ARCH;
use std::path::{absolute, PathBuf}; use std::path::{absolute, PathBuf};
use cxx_build::CFG; use cxx_build::CFG;
@ -126,10 +127,7 @@ fn main() {
}); });
// NCCL is slightly trickier because it might not have a pkgconfig installed // NCCL is slightly trickier because it might not have a pkgconfig installed
let nccl_library_path = NCCL_ROOT_DIR.unwrap_or(&format!( let nccl_library_path = NCCL_ROOT_DIR.unwrap_or(&format!("/usr/local/{}-linux-gnu", ARCH));
"/usr/local/{}-linux-gnu",
env::var("CARGO_CFG_TARGET_ARCH").unwrap()
));
println!(r"cargo:rustc-link-search=native={}", nccl_library_path); println!(r"cargo:rustc-link-search=native={}", nccl_library_path);
println!("cargo:rustc-link-lib=dylib=nccl"); println!("cargo:rustc-link-lib=dylib=nccl");