LIBRARY-NOTFOUND errors in my LibTorch for aarch64 cause the build to fail

I installed LibTorch to my Jetson AGX Xavier (aarch64) and I’m getting library not found errors.

I downloaded pytorch by git clone from the official GitHub. Link here GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration

I executed ‘python3 /tools/build_libtorch.py’ from the root pytorch dir to install Libtorch.

I’m trying to build the example script from the official PyTorch page here.

This is the error I get now when I run cmake -DCMAKE_PREFIX_PATH=/home/jet/pytorch/ …

$ cmake -DCMAKE_PREFIX_PATH=/home/jet/pytorch/ ..                                              
-- The C compiler identification is Clang 6.0.0                                                                                          
-- The CXX compiler identification is Clang 6.0.0                                                                                        
-- Detecting C compiler ABI info                                                                                                         
-- Detecting C compiler ABI info - done                                                                                                  
-- Check for working C compiler: /usr/lib/ccache/clang - skipped                                                                         
-- Detecting C compile features                                                                                                          
-- Detecting C compile features - done                                                                                                   
-- Detecting CXX compiler ABI info                                                                                                       
-- Detecting CXX compiler ABI info - done                                                                                                
-- Check for working CXX compiler: /usr/lib/ccache/clang++ - skipped                                                                     
-- Detecting CXX compile features                                                                                                        
-- Detecting CXX compile features - done                                                                                                 
CMake Warning at /home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):                                                 
static library onnx_LIBRARY-NOTFOUND not found.                                                                                        
Call Stack (most recent call first):                                                                                                       
/home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:104 (append_torchlib_if_found)                                               
CMakeLists.txt:4 (find_package)                                                                                                                                                                                                                                                                                                                                                                                          
CMake Warning at /home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):                                                 
static library foxi_loader_LIBRARY-NOTFOUND not found.                                                                                 
Call Stack (most recent call first):                                                                                                       
/home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:106 (append_torchlib_if_found)                                               
CMakeLists.txt:4 (find_package)                                                                                                                                                                                                                                                                                                                                                                                          
CMake Warning at /home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):                                                 
static library fmt_LIBRARY-NOTFOUND not found.                                                                                         
Call Stack (most recent call first):                                                                                                       
/home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:106 (append_torchlib_if_found)                                               
CMakeLists.txt:4 (find_package)                                                                                                                                                                                                                                                                                                                                                                                          
CMake Warning at /home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):                                                 
static library eigen_blas_LIBRARY-NOTFOUND not found.                                                                                  
Call Stack (most recent call first):                                                                                                       
/home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:113 (append_torchlib_if_found)                                               
CMakeLists.txt:4 (find_package)                                                                                                                                                                                                                                                                                                                                                                                          
CMake Warning at /home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:22 (message):                                                 
static library asmjit_LIBRARY-NOTFOUND not found.                                                                                      
Call Stack (most recent call first):                                                                                                       
/home/jet/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:123 (append_torchlib_if_found)                                              
CMakeLists.txt:4 (find_package)                                                                                                                                                                                                                                                                                                                                                                                          
-- Found Torch: /home/jet/pytorch/torch/lib/libtorch.a                                                                                   
-- Configuring done                                                                                                                      
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.                                             
Please set them or make sure they are set and tested correctly in the CMake files:                                                       
-Wl,-force_load,/home/jet/pytorch/torch/lib/libtorch.a;-Wl,-force_load,/home/jet/pytorch/torch/lib/libtorch_cpu.a;-Wl,-force_load,/home/jet/pytorch/torch/lib/libtorch_cuda.a;-Wl,-force_load,/home/jet/pytorch/torch/lib/libc10_cuda.a;/home/jet/pytorch/torch/lib/libc10.a;/home/jet/pytorch/torch/lib/libcaffe2_protos.a;/home/jet/pytorch/torch/lib/libprotobuf-lite.a;/home/jet/pytorch/torch/lib/libprotobuf.a;/home/jet/pytorch/torch/lib/libprotoc.a;/usr/lib/aarch64-linux-gnu/libonnx_proto.a;/home/jet/pytorch/torch/lib/libclog.a;/home/jet/pytorch/torch/lib/libcpuinfo.a;/home/jet/pytorch/torch/lib/libsleef.a;/home/jet/pytorch/torch/lib/libkineto.a;LIBNVTOOLSEXT                              
linked by target "example-app" in directory /home/jet/example-app                                                                                                                                                                                                             
-- Generating done                                                                                                                       
CMake Generate step failed.  Build files cannot be regenerated correctly. ```  

My Linux Version
4.9.253-tegra #1 SMP PREEMPT Mon Jul 26 12:19:28 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux

My CUDA version is 10.2