Compiling example-app.cpp gives error in jetson nano after reboot

Hello,

I have built libtorch from source in my jetson nano 4gb. The following output was generated after building:

3 warnings generated.
[1826/1827] Install the project...
-- Install configuration: "Release"
-- Set runtime path of "/home/fahim/pytorch/torch/bin/protoc-3.13.0.0" to "$ORIGIN/../lib"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libc10.so" to "$ORIGIN"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libc10_cuda.so" to "$ORIGIN:/usr/local/cuda/lib64"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libcaffe2_nvrtc.so" to "$ORIGIN:/usr/local/cuda/lib64/stubs:/usr/local/cuda/lib64"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libtorch_cpu.so" to "$ORIGIN:/usr/lib/aarch64-linux-gnu/openmpi/lib:/usr/local/cuda/lib64"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libtorch_cuda.so" to "$ORIGIN:/usr/local/cuda/lib64:/usr/lib/aarch64-linux-gnu/openmpi/lib"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libtorch.so" to "$ORIGIN:/usr/local/cuda/lib64"
-- Set runtime path of "/home/fahim/pytorch/torch/lib/libtorch_global_deps.so" to "$ORIGIN:/usr/lib/aarch64-linux-gnu/openmpi/lib:/usr/local/cuda/lib64"

Right after building, I compiled and ran the following code (example-app.cpp) without any error:

#include <iostream>
#include <torch/torch.h>

using namespace std;

int main(){
    torch::Tensor tensor = torch::rand({2, 3});
    cout << tensor << endl;
    cout << torch::hypot(torch::tensor(1.),torch::tensor(1.))<< endl;

    auto t = torch::ones({3, 3}, torch::dtype(torch::kFloat32));
    cout << "t:\n" << t << endl;
    cout << "t.exp():\n" << t.exp() << endl;

    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example-app)

set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

add_executable(example-app example-app.cpp)
target_link_libraries(example-app "${TORCH_LIBRARIES}")
set_property(TARGET example-app PROPERTY CXX_STANDARD 14)

However, after a reboot, if I compile the same app, it gives me an error.

Compiled example-app.cpp (in build folder) using :

$ cmake -D CMAKE_PREFIX_PATH=/home/fahim/pytorch ..
$ cmake --build . --config Release

Output of cmake -D CMAKE_PREFIX_PATH=/home/fahim/pytorch ..

fahim@fahim-desktop:~/code/build$ cmake -D CMAKE_PREFIX_PATH=/home/fahim/pytorch ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/lib/ccache/cc
-- Check for working C compiler: /usr/lib/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "10.2")
-- Caffe2: CUDA detected: 10.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.2
-- Found CUDNN: /usr/lib/aarch64-linux-gnu/libcudnn.so
-- Found cuDNN: v8.2.1  (include: /usr/include, library: /usr/lib/aarch64-linux-gnu/libcudnn.so)
-- /usr/local/cuda/lib64/libnvrtc.so shorthash is 7d272a04
-- Autodetected CUDA architecture(s):  5.3
-- Added CUDA NVCC flags for: -gencode;arch=compute_53,code=sm_53
-- Found Torch: /home/fahim/pytorch/torch/lib/libtorch.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fahim/code/build

Output of cmake --build . --config Release

Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:38:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/aarch64-linux-gnu/c++/7.5.0/bits/c++config.h:250:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/aarch64-linux-gnu/c++/7.5.0/bits/c++config.h:438:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/aarch64-linux-gnu/c++/7.5.0/bits/c++config.h:563:3: error:
      invalid token at start of a preprocessor expression
  && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L     \
  ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:40:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/char_traits.h:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algobase.h:66:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_iterator_base_funcs.h:107:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:41:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_classes.h:40:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/string:52:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:56:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:41:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_classes.h:40:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/string:53:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.tcc:50:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:41:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_classes.h:354:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:46:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/system_error:41:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/stdexcept:46:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/stdexcept:127:28: error:
      invalid token at start of a preprocessor expression
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
                           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/stdexcept:211:28: error:
      invalid token at start of a preprocessor expression
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
                           ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:46:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/system_error:91:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:1:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iostream:39:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ostream:38:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/ios:42:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:230:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/ios_base.h:254:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:2:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/all.h:8:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/types.h:3:
In file included from /home/fahim/pytorch/torch/include/ATen/ATen.h:7:
In file included from /home/fahim/pytorch/torch/include/c10/core/Allocator.h:6:
In file included from /home/fahim/pytorch/torch/include/c10/core/Device.h:3:
In file included from /home/fahim/pytorch/torch/include/c10/core/DeviceType.h:8:
In file included from /home/fahim/pytorch/torch/include/c10/macros/Macros.h:228:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/sstream:297:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:2:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/all.h:8:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/types.h:3:
In file included from /home/fahim/pytorch/torch/include/ATen/ATen.h:7:
In file included from /home/fahim/pytorch/torch/include/c10/core/Allocator.h:6:
In file included from /home/fahim/pytorch/torch/include/c10/core/Device.h:3:
In file included from /home/fahim/pytorch/torch/include/c10/core/DeviceType.h:8:
In file included from /home/fahim/pytorch/torch/include/c10/macros/Macros.h:228:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/sstream:826:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/sstream.tcc:92:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
In file included from /home/fahim/code/example-app.cpp:2:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/all.h:8:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4:
In file included from /home/fahim/pytorch/torch/include/torch/csrc/api/include/torch/types.h:3:
In file included from /home/fahim/pytorch/torch/include/ATen/ATen.h:9:
In file included from /home/fahim/pytorch/torch/include/ATen/Context.h:4:
In file included from /home/fahim/pytorch/torch/include/ATen/Tensor.h:3:
In file included from /home/fahim/pytorch/torch/include/ATen/core/TensorBody.h:14:
In file included from /home/fahim/pytorch/torch/include/c10/core/TensorImpl.h:19:
In file included from /home/fahim/pytorch/torch/include/c10/util/Logging.h:28:
In file included from /home/fahim/pytorch/torch/include/c10/util/logging_is_not_google_glog.h:8:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/iomanip:43:
In file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/locale:41:
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_facets_nonio.h:719:27: error:
      expected value in expression
#if _GLIBCXX_USE_CXX11_ABI
                          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_facets_nonio.h:1567:33: error:
      invalid token at start of a preprocessor expression
      && _GLIBCXX_USE_CXX11_ABI == 0
                                ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_facets_nonio.h:1590:33: error:
      invalid token at start of a preprocessor expression
      && _GLIBCXX_USE_CXX11_ABI == 0
                                ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/locale_facets_nonio.h:1712:33: error:
      invalid token at start of a preprocessor expression
      && _GLIBCXX_USE_CXX11_ABI == 0
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
CMakeFiles/example-app.dir/build.make:62: recipe for target 'CMakeFiles/example-app.dir/example-app.cpp.o' failed
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/example-app.dir/all' failed
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

~/pytorch was created using git clone -b v1.10.0 --depth=1 --recursive https://github.com/pytorch/pytorch.git

example-app.cpp compiles again after I run the following manually:

$ cd ~/pytorch/build_libtorch/
$ export BUILD_PYTHON=OFF
$ export BUILD_CAFFE2_OPS=OFF
$ export USE_FBGEMM=OFF
$ export USE_FAKELOWP=OFF
$ export BUILD_TEST=OFF
$ export USE_MKLDNN=OFF
$ export USE_NNPACK=OFF
$ export USE_XNNPACK=OFF
$ export USE_QNNPACK=OFF
$ export USE_PYTORCH_QNNPACK=OFF
$ export USE_CUDA=ON
$ export USE_CUDNN=ON
$ export TORCH_CUDA_ARCH_LIST="5.3;6.2;7.2"
$ export MAX_JOBS=4
$ export USE_NCCL=OFF
$ export USE_OPENCV=OFF
$ export USE_SYSTEM_NCCL=OFF
$ export BUILD_SHARED_LIBS=ON
$ PATH=/usr/lib/ccache:$PATH
$ export CC=clang
$ export CXX=clang++
$ python3 ../tools/build_libtorch.py

The outout of cmake -D CMAKE_PREFIX_PATH=/home/fahim/pytorch .. is a bit different now:

fahim@fahim-desktop:~/code/build$ cmake -D CMAKE_PREFIX_PATH=/home/fahim/pytorch ..
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/lib/ccache/clang
-- Check for working C compiler: /usr/lib/ccache/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/ccache/clang++
-- Check for working CXX compiler: /usr/lib/ccache/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "10.2")
-- Caffe2: CUDA detected: 10.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.2
-- Found CUDNN: /usr/lib/aarch64-linux-gnu/libcudnn.so
-- Found cuDNN: v8.2.1  (include: /usr/include, library: /usr/lib/aarch64-linux-gnu/libcudnn.so)
-- /usr/local/cuda/lib64/libnvrtc.so shorthash is 7d272a04
CMake Warning at /home/fahim/pytorch/torch/share/cmake/Caffe2/public/utils.cmake:365 (message):
  In the future we will require one to explicitly pass TORCH_CUDA_ARCH_LIST
  to cmake instead of implicitly setting it as an env variable.  This will
  become a FATAL_ERROR in future version of pytorch.
Call Stack (most recent call first):
  /home/fahim/pytorch/torch/share/cmake/Caffe2/public/cuda.cmake:437 (torch_cuda_get_nvcc_gencode_flag)
  /home/fahim/pytorch/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  /home/fahim/pytorch/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:7 (find_package)


-- Added CUDA NVCC flags for: -gencode;arch=compute_53,code=sm_53;-gencode;arch=compute_62,code=sm_62;-gencode;arch=compute_72,code=sm_72
-- Found Torch: /home/fahim/pytorch/torch/lib/libtorch.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fahim/code/build

I think there’s some linking issues, but I am not sure how to fix this.

Sorry for the long post.

@Fahim_SS Were you able to fix this issue? I am facing the same issue while compiling the example-cpp on my jetson nano.

Just adding a #define _GLIBCXX_USE_CXX11_ABI 1 before makes it work. Hoping that this will help someone.