Making libtorch

I’m following the steps here

My folder structure is as follows:

  • build/
  • libtorch/
  • CmakeLists.txt
  • example-app.cpp

The latter files are as described in the link. build is empty and for the libtorch folder I downloaded the gpu version from the main download page.

When I run the following command inside the build folder:

cmake -DCMAKE_PREFIX_PATH=../libtorch ..

I get the following message:

-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: /usr/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr
-- Caffe2: Header version is: 10.1
-- Found cuDNN: v8.0.4  (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/
-- Autodetected CUDA architecture(s):  6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
-- Configuring done
CMake Warning at CMakeLists.txt:7 (add_executable):
  Cannot generate a safe runtime search path for target example-app because
  files in some directories may conflict with libraries in implicit

    runtime library [] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
    runtime library [] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
    runtime library [] in /usr/lib/x86_64-linux-gnu may be hidden by files in:

  Some of these libraries may not be found correctly.

-- Generating done
-- Build files have been written to: /home/joe/Documents/torchscript/build

I am a complete noob with Linux and c++/cmake. I have looked far and wide but cannot find out how to solve this. I don’t understand enough what information I should provide for help but here’s what I know.

Nvidia-smi and nvcc --version tell me I have CUDA 11.1 and driver version 455.23.05. My LD_LIBRARY_PATH is:


My PATH is:


I installed Pytorch 1.6 with Anaconda if that matters.

I am out of ideas on how to fix this. Any help is welcome!

Based on the output it seems the build files have been written successfully.
Do you get an error in any step or just this warning?

You are right, it does work! I just get these warnings