Hello to all.
I wrote a simple program to import model.
I used cmake to build the program. There was no mistake. But when I ran make, it said could not find common.h
fatal error: common.h: No such file or directory
#include "common.h"
^~~~~~~~~~
compilation terminated.
CMakeFiles/tensorRTtest.dir/build.make:62: recipe for target 'CMakeFiles/tensorRTtest.dir/tensorRTtest.cpp.o' failed
make[2]: *** [CMakeFiles/tensorRTtest.dir/tensorRTtest.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/tensorRTtest.dir/all' failed
make[1]: *** [CMakeFiles/tensorRTtest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Is this caused by cmake mistake?
And I’m using Jetson Xavier. Jetpack version is 4.2.0.
Cuda version: 10.0
TensorRT verison: 5.0.6
For now, I can import tensorRT using python
SunilJB
February 7, 2020, 10:20am
3
Hi,
“common.h” is part of TensorRT samples-> common folder. Please refer to below link:
https://github.com/NVIDIA/TensorRT/blob/master/samples/common/common.h
Thanks
Thank you for your reply.
I found this file before. And I also tried to copy this to my program’s folder. But it caused another problem. It could not found cuda_runtime_api.h this time.
That’s why I am wondering whether it will be my cmakelist that caused the problem.
The tensorRT folder locates at /usr/src/tensorrt.
And this is my cmakelists.txt
cmake_minimum_required(VERSION 2.8)
project(tensorRTtest)
find_package(CUDA REQUIRED)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_61,code=sm_61;-std=c++11;)
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
HINTS ${TENSORRT_ROOT} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES include)
MESSAGE(STATUS "Found TensorRT headers at ${TENSORRT_INCLUDE_DIR}")
find_library(TENSORRT_LIBRARY_INFER nvinfer
HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
find_library(TENSORRT_LIBRARY_INFER_PLUGIN nvinfer_plugin
HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
set(TENSORRT_LIBRARY ${TENSORRT_LIBRARY_INFER} ${TENSORRT_LIBRARY_INFER_PLUGIN})
MESSAGE(STATUS "Find TensorRT libs at ${TENSORRT_LIBRARY}")
find_package_handle_standard_args(
TENSORRT DEFAULT_MSG TENSORRT_INCLUDE_DIR TENSORRT_LIBRARY)
if(NOT TENSORRT_FOUND)
message(ERROR "Cannot find TensorRT library.")
endif()
add_executable(tensorRTtest tensorRTtest.cpp)
SunilJB
February 10, 2020, 9:16am
5