Compile with tensorrt lib on jetson orin nano devkit in C++


I want to use the TensorRT library in a C++ program. So, I add the following line in my CMakeLists.txt file :
find_package(TensorRT REQUIRED)

When I run the cmake command, I’ve got an error :

CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "FindTensorRT.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "TensorRT",
  but CMake did not find one.

  Could not find a package configuration file provided by "TensorRT" with any
  of the following names:


  Add the installation prefix of "TensorRT" to CMAKE_PREFIX_PATH or set
  "TensorRT_DIR" to a directory containing one of the above files.  If
  "TensorRT" provides a separate development package or SDK, be sure it has
  been installed.

My configurations is as follow :
Jetson Orin nano Developer Kit (install from the SD Card Image Method)
Jetpack 5.1.1
CUDA: 11.4.315
TensorRT: (the command dpkg-query -W tensorrt return tensorrt

I can’t find the TensorRTConfig.cmake file, the tensorrt-config.cmake file or the TensorRT- folder. I just have a tensorrt folder in /usr/src/ :

cor@wporin:/usr/src/tensorrt$ ls
bin  data  samples

Is the TensorRt library really installed? What am I missing here?



TensorRT library is called nvinfer and is located at:

$ ll /usr/lib/aarch64-linux-gnu/libnvinfer*
$ ll /usr/include/aarch64-linux-gnu/NvInfer*

Below is a sample cmake file for your reference:


@AastaLLL, thank you for your answer. I finally get it to work by creating a file like this one :

Then I copy it into the same directory as my CMakeLists.txt file and everything is fine.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.