Natsu-Akatsuki / RangeNetTrt8

tensorrt8 && cuda && libtorch implementation of rangenet++
MIT License
44 stars 9 forks source link

编译报错 #6

Closed yiyan991022 closed 1 year ago

yiyan991022 commented 1 year ago

您好,我编译的过程中出现了这样的错误

Errors << rangenet_plusplus:cmake /home/yy/catkin_ws1/logs/rangenet_plusplus/build.cmake.000.log CMake Error at /home/yy/catkin_ws1/src/RangeNetTrt8/CMakeLists.txt:37 (find_package): By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Torch", but CMake did not find one.

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

TorchConfig.cmake
torch-config.cmake

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

我已经在CMakeLists中修改了libtorch的路径,以下是我CMakeLists中的内容,我是直接按照命令行把libtorch解压到了主目录下

导入第三方库

set(Torch_DIR "$ENV{HOME}/home/yy/libtorch/share/cmake/Torch") find_package(Torch REQUIRED) find_package(OpenCV REQUIRED) find_package(PCL REQUIRED QUIET) find_package(yaml-cpp REQUIRED) include_directories(${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${TORCH_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR})

请问这个问题怎么解决,非常感谢

Natsu-Akatsuki commented 1 year ago

set(Torch_DIR "$ENV{HOME}/home/yy/libtorch/share/cmake/Torch") 我看你这里多了一个这个$ENV{HOME},然后就会解析成:set(Torch_DIR "/home/yy/home/yy/libtorch/share/cmake/Torch")

yiyan991022 commented 1 year ago

谢谢,这个问题已解决

yiyan991022 commented 1 year ago

又有一个新的错误

Errors << rangenet_plusplus:cmake /home/yy/catkin_ws1/logs/rangenet_plusplus/build.cmake.003.log CMake Error at /home/yy/libtorch/share/cmake/Caffe2/public/cuda.cmake:176 (message): PyTorch requires cuDNN 7 and above. Call Stack (most recent call first): /home/yy/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include) /home/yy/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package) CMakeLists.txt:41 (find_package)

我之前已经下载过cudnn8.2.4,解压之后是一个cuda文件,我cd到这个文件夹之后进行了这样的操作 sudo cp include/cudnn.h /usr/local/cuda-11.4/include sudo cp lib64/libcudnn /usr/local/cuda-11.4/lib64 sudo chmod a+r /usr/local/cuda-11.4/include/cudnn.h /usr/local/cuda-11.4/lib64/libcudnn 这样操作会不会产生错误,需不需要把cuda的文件名改为cudnn呢,下载解压后正确的操作步骤是怎么样的,感谢

Natsu-Akatsuki commented 1 year ago

你这个是有关cudnn8.2.4环境配置的问题。你所述的安装方法无误,无需改名。

yiyan991022 commented 1 year ago

好的,那在./bashrc应该怎么加语句,或者怎么修改呢

Natsu-Akatsuki commented 1 year ago

如果说环境变量的话,可参考如下例子进行改写 CUDA_PATH=/usr/local/cuda/bin TENSORRT_PATH=${HOME}/application/TensorRT-8.2.3.0/bin CUDA_LIB_PATH=/usr/local/cuda/lib64

TENSORRT_LIB_PATH=${HOME}/application/TensorRT-8.2.3.0/lib PYTORCH_LIB_PATH=${HOME}/application/libtorch/lib export PATH=${PATH}:${CUDA_PATH}:${TENSORRT_PATH} export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_LIB_PATH}:${TENSORRT_LIB_PATH}:${PYTORCH_LIB_PATH}

Natsu-Akatsuki commented 1 year ago

这里的环境配置问题多因一果,不一定能起作用

yiyan991022 commented 1 year ago

谢谢您的解答! 我的环境变量是下面这样的,我没看出问题,您看有问题吗

export PATH="/home/yy/.local/bin:$PATH" CUDA_PATH=/usr/local/cuda/bin TENSORRT_PATH=${HOME}/TensorRT-8.2.1.8/bin CUDA_LIB_PATH=/usr/local/cuda/lib64 TENSORRT_LIB_PATH=${HOME}/TensorRT-8.2.1.8/lib PYTORCH_LIB_PATH=${HOME}/libtorch/lib export PATH=${PATH}:${CUDA_PATH}:${TENSORRT_PATH} export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_LIB_PATH}:${TENSORRT_LIB_PATH}:${PYTORCH_LIB_PATH}

Natsu-Akatsuki commented 1 year ago

没发现问题

yiyan991022 commented 1 year ago

好的,谢谢您