Perhaps building with LIBTORCH_STATIC=1 may help, see crate tch. When downloaded, libtorch shared objects are stored under torch-sys in your project build folder