Skip to content

Commit

Permalink
Adjust libtorch static library list and option
Browse files Browse the repository at this point in the history
  • Loading branch information
juhofuriosa committed Sep 23, 2024
1 parent 7d6ac77 commit 10a1ed7
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions torch-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ impl SystemInfo {
match self.link_type {
LinkType::Dynamic => println!("cargo:rustc-link-lib={lib_name}"),
LinkType::Static => {
// TODO: whole-archive might only be necessary for libtorch_cpu?
println!("cargo:rustc-link-lib=static:+whole-archive,-bundle={lib_name}")
// Removed whole-archive option
println!("cargo:rustc-link-lib=static:-bundle={lib_name}")
}
}
}
Expand Down Expand Up @@ -495,25 +495,12 @@ fn main() -> anyhow::Result<()> {
system_info.link("torch_python")
}
if system_info.link_type == LinkType::Static {
// TODO: this has only be tried out on the cpu version. Check that it works
// with cuda too and maybe just try linking all available files?
system_info.link("asmjit");
system_info.link("clog");
system_info.link("cpuinfo");
system_info.link("dnnl");
system_info.link("dnnl_graph");
system_info.link("fbgemm");
system_info.link("gloo");
system_info.link("kineto");
system_info.link("nnpack");
system_info.link("onnx");
system_info.link("onnx_proto");
system_info.link("protobuf");
system_info.link("eigen_blas");
system_info.link("fmt");
system_info.link("pthreadpool");
system_info.link("pytorch_qnnpack");
system_info.link("sleef");
system_info.link("tensorpipe");
system_info.link("tensorpipe_uv");
system_info.link("XNNPACK");
}
system_info.link("torch_cpu");
Expand Down

0 comments on commit 10a1ed7

Please sign in to comment.