PRBonn / rangenet_lib

Inference module for RangeNet++ (milioto2019iros, chen2019iros)
MIT License
309 stars 72 forks source link

TensorRT Not Found Ubuntu 20.04 #36

Closed Mathanraj-Sharma closed 3 years ago

Mathanraj-Sharma commented 3 years ago

I have installed TensorRT and it is working fine with the sample code as mentioned in the link.

But when I "catkin build" rangenet_lib I get this error. `Build type: Release YAML Libs: yaml-cpp YAML Headers: /usr/lib/x86_64-linux-gnu/cmake/yaml-cpp/../../../../../include Boost Libs: Boost::program_options;Boost::filesystem Boost Headers: /usr/include

TensorRT NOT Available TensorRT NOT FOUND

CMake Error at /media/mathanraj-sharma/HDD/Final-year-research/catkin_ws/src/rangenet_lib/CMakeLists.txt:60 (message): TensorRT must be installed

TENSORRT_FOUND OFF

cd /media/mathanraj-sharma/HDD/Final-year-research/catkin_ws/build/rangenet_lib; catkin build --get-env rangenet_lib | catkin env -si /usr/bin/cmake /media/mathanraj-sharma/HDD/Final-year-research/catkin_ws/src/rangenet_lib --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/media/mathanraj-sharma/HDD/Final-year-research/catkin_ws/devel/.private/rangenet_lib -DCMAKE_INSTALL_PREFIX=/media/mathanraj-sharma/HDD/Final-year-research/catkin_ws/install; cd - ....................................................................................................................... Failed << rangenet_lib:cmake [ Exited with code 1 ]
Failed <<< rangenet_lib [ 0.8 seconds ]
[build] Summary: 1 of 2 packages succeeded.
[build] Ignored: None.
[build] Warnings: None.
[build] Abandoned: None.
[build] Failed: 1 packages failed. `

I have tried modifying the CMakeList.txt like mentioned in #13 . But still, I get this error.

TensorRT is installed at /opt/TensorRT in my System.

Mathanraj-Sharma commented 3 years ago

Hi, modified the "tensorrt-config.cmake" a bit and it does the magic.

find_package(CUDA)

set(CMAKE_PREFIX_PATH "/opt/TensorRT-5.1.5.0/lib") find_library(NVINFER NAMES nvinfer) find_library(NVINFERPLUGIN NAMES nvinfer_plugin) find_library(NVPARSERS NAMES nvparsers) find_library(NVONNXPARSER NAMES nvonnxparser) find_library(NVONNXPARSERRUNTIME NAMES nvonnxparser_runtime)

if(CUDA_FOUND AND NVINFER AND NVINFERPLUGIN AND NVPARSERS AND NVONNXPARSER AND NVONNXPARSERRUNTIME) message("TensorRT available!") message("CUDA Libs: ${CUDA_LIBRARIES}") message("CUDA Headers: ${CUDA_INCLUDE_DIRS}") message("NVINFER: ${NVINFER}") message("NVINFERPLUGIN: ${NVINFERPLUGIN}") message("NVPARSERS: ${NVPARSERS}") message("NVONNXPARSER: ${NVONNXPARSER}") message("NVONNXPARSERRUNTIME: ${NVONNXPARSERRUNTIME}") list(APPEND TENSORRT_LIBRARIES ${CUDA_LIBRARIES} nvinfer nvinfer_plugin nvparsers nvonnxparser nvonnxparser_runtime) message("All togheter now (libs): ${TENSORRT_LIBRARIES}") list(APPEND TENSORRT_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS} "/opt/TensorRT-5.1.5.0/include") message("All togheter now (inc): ${TENSORRT_INCLUDE_DIRS}") set(TENSORRT_FOUND ON) else() message("TensorRT NOT Available") set(TENSORRT_FOUND OFF) endif()`

It resolved the above issue but I got a new issue while building.

Since I have installed the TensorRT under /opt/ there was an issue in linking TensorRT libraries while building.

/usr/bin/ld: cannot find -lnvinfer /usr/bin/ld: cannot find -lnvinfer_plugin /usr/bin/ld: cannot find -lnvparsers /usr/bin/ld: cannot find -lnvonnxparser /usr/bin/ld: cannot find -lnvonnxparser_runtime collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/rangenet_lib.dir/build.make:118: /home/mathanraj-sharma/range_ws/devel/.private/rangenet_lib/lib/librangenet_lib.so] Error 1 make[1]: *** [CMakeFiles/Makefile2:335: CMakeFiles/rangenet_lib.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

Adding symbolic links for those library files solved that issue too. sudo ln -s /opt/TensorRT-5.1.5.0/lib/libnvonnxparser_runtime.so /usr/lib/libnvonnxparser_runtime.so did the same for other lib files too.