Skip to content

Commit

Permalink
Link nvinfer_pluing as a static library instead of dynamic. This will
Browse files Browse the repository at this point in the history
reduce some of the headache with how TensorRT installs on the system as
well as make the install experience with end users of the library a little
bit smoother.

Ideally we would like to statically link all of the TensorRT libraries but
that doesn't seem possible at this stage due to protobuf symobls not being
found in the static version of nvinfer and nvparsers. This seems to be a
bug in the binary releases of these artifacts.
  • Loading branch information
mstallmo committed Sep 18, 2020
1 parent 42a38f7 commit fc26b68
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a filter=lfs diff=lfs merge=lfs -text
tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a filter=lfs diff=lfs merge=lfs -text
tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a filter=lfs diff=lfs merge=lfs -text
Git LFS file not shown
3 changes: 3 additions & 0 deletions tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a
Git LFS file not shown
3 changes: 3 additions & 0 deletions tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a
Git LFS file not shown
5 changes: 5 additions & 0 deletions tensorrt-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ fn configuration(full_library_path: &PathBuf) {
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-flags=-l dylib=nvinfer");
println!("cargo:rustc-flags=-l dylib=nvparsers");
println!("cargo:rustc-flags=-L {}/3rdParty/TensorRT-5.1.5", env!("CARGO_MANIFEST_DIR"));
println!("cargo:rustc-flags=-l static=nvinfer_plugin_static");
cuda_configuration();
} else {
panic!("Invalid nvinfer version found. Expected: libnvinfer.so.5.1.5, Found: {}", full_library_path.to_str().unwrap());
Expand All @@ -67,6 +69,9 @@ fn configuration(full_library_path: &PathBuf) {
fn cuda_configuration() {
println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64");
println!("cargo:rustc-flags=-l dylib=cudart");
println!("cargo:rustc-flags=-l dylib=cublas");
println!("cargo:rustc-flags=-l dylib=cublasLt");
println!("cargo:rustc-flags=-l dylib=cudnn");
}

#[cfg(feature = "cuda-102")]
Expand Down

0 comments on commit fc26b68

Please sign in to comment.