制作ubuntu18.04 cuda10.2+ROS1的 docker镜像

使用的硬件平台为Xavier NX,系统环境如下图:
搭建docker环境需求跟实际环境一致如下图:
在这里插入图片描述从官网获取cuda10.2版本只有支持x86的,如下网站:
https://developer.nvidia.com/cuda-10.2-download-archive
下面从sdk manager中获取方法的进行从论坛中获取:

https://forums.developer.nvidia.com/t/how-to-install-cuda-10-2-to-jetson-tx2/241479/3

小知识:

  1. docker去掉sudo方法:
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl restart docker
newgrp docker
id $USER
  1. docker容器启动时,会执行/root/.bashrc。所以自启动的东西可以在/root/.bashrc中进行添加。
  2. 编译依赖cuda,可设置路径 CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2

1. 下载安装包

现在使用的SDK Manager版本为2.1.0.直接打开软件,看到最老的版本只能到4.6.3,如下图:
在这里插入图片描述
如果要使用老的JETPACK,如上图我们要使用4.6的版本。我们可以使用下面命令打开SDK Manager:

sdkmanager --archived-versions

打开后可以看到老版本如下图:
在这里插入图片描述
然后按照正常SDK Manager下载流程下载JETPACK安装包,如下(只下载不进行烧录,等待下载完成):在这里插入图片描述

2. 下载基础镜像
基础镜像地址:https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags
可以在网站上下载基础docker镜像,如需求32.6.1版本,那么我们使用docker拉取基础镜像:

docker pull nvcr.io/nvidia/l4t-base:r32.6.1

3. 启动容器(运行脚本start_docker.sh,内容如下:)

#!/bin/bash

docker run -it \
    --rm \
    -v $(pwd)/:/opt/ws/ \
    -v /home:/home \
    -v /etc/localtime:/etc/localtime:ro \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e DISPLAY=unix$DISPLAY \
    -w /opt/ws/ \
    --hostname tn \
    nvcr.io/nvidia/l4t-base:r32.6.1

4. 安装基本环境

  1. 在docker中基于ubuntu18.04 安装ros
    更新source源
apt-get update

安装sudo 和 lsb_release工具

apt-get install sudo
apt-get install -y vim
sudo apt-get install -y lsb-core
sudo apt install -y python-pip
sudo apt install -y  python3-pip

向ros源中添加ros源地址,并配置公钥,如果rosdep update执行失败,可以尝试多试几次.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install -y ros-melodic-desktop-full
sudo apt install python3-rosdep
sudo rosdep init
sudo rosdep update
source /opt/ros/melodic/setup.sh

rosdep update后正确的打印如下:

root@tn:/opt/ws/work# sudo rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Warning: running 'rosdep update' as root is not recommended.
  You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Skip end-of-life distro "foxy"
Skip end-of-life distro "galactic"
Skip end-of-life distro "groovy"
Add distro "humble"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Add distro "iron"
Skip end-of-life distro "jade"
Add distro "jazzy"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /root/.ros/rosdep/sources.cache

  1. 因为我们工程使用的是python3.6,所以将python软连接到python3.8
bashroot@tn:/usr/bin# rm -f python
root@tn:/usr/bin# ln -s python3.6 python
  1. 安装cuda
    通过sdk manager下载下来的deb包来安装cuda。可以参考https://developer.ridgerun.com/wiki/index.php/Installing_CUDA-toolkit_and_VisionWorks_Jetson_TX2/Xavier/Nano
    下面可以解决(#include <NvInfer.h>缺失问题):
sudo dpkg -i cuda-repo-l4t-10-2-local_10.2.460-1_arm64.deb
sudo apt-key add /var/cuda-repo-l4t-10-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda-toolkit-10-2
sudo dpkg -i cuda-repo-cross-aarch64-ubuntu1804-10-2-local_10.2.460-1_all.deb
sudo dpkg -i libcudnn8_8.2.1.32-1+cuda10.2_arm64.deb
sudo dpkg -i libnvinfer8_8.0.1-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8-dev_8.2.1.32-1+cuda10.2_arm64.deb
sudo dpkg -i libnvinfer-dev_8.0.1-1+cuda10.2_arm64.deb
  1. 安装opencv 4.5.4
    下载opencv4.5.4和opencv_contrib4.5.4版本,将opencv_contrib4.5.4放置在opencv目录下,可以参考:
    https://developer.ridgerun.com/wiki/index.php/Compiling_OpenCV_from_Source
    配置
cmake \
-D WITH_FFMPEG=ON \
-D CMAKE_BUILD_TYPE=Release \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ \
-D CUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so \
-D CUDA_ARCH_BIN=6.1 \
-D CUDA_ARCH_PTX="" \
-D WITH_CUDA=ON \
-D WITH_TBB=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_V4L=ON \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_NVCUVID=ON \
-D BUILD_opencv_cudacodec=ON ..


配置输出部分结果如下:

--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
-- 
--   NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             61
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 8.2.1)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /opt/ws/work/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.17)
--     Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
--     install path:                lib/python2.7/dist-packages/cv2/python-2.7
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.6.9)
--     Libraries:                   /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
--     numpy:                       /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.19.5)
--     install path:                lib/python3.6/dist-packages/cv2/python-3.6
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done

编译并安装

make -j8
make install
  1. 配置docker,并导出镜像文件。
docker commit -a "tn" -m "drone in xavier nx ubuntu18.04" clever_varahamihira drone-xavier-nx-ubuntu18.04-v1:r32.6.1
docker save -o drone_melodic_xavier_nx_v1.tar drone-xavier-nx-ubuntu18.04-v1:r32.6.1

8.其他设备进行加载。

docker load -i drone_melodic_xavier_nx_v1.tar

编译出现的错误如下:

CMake Error at CMakeLists.txt:22 (message):
  Search for 'catkin' in workspace failed (catkin_find_pkg catkin
  /opt/ws/work/drone_melodic/catkin_ws/src): Traceback (most recent call
  last):

    File "/usr/bin/catkin_find_pkg", line 6, in <module>
      from pkg_resources import load_entry_point
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
      @_call_aside
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
      f(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
      working_set = WorkingSet._build_master()
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 574, in _build_master
      ws.require(__requires__)
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require
      needed = self.resolve(parse_requirements(requirements))
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve
      raise DistributionNotFound(req, requirers)

  pkg_resources.DistributionNotFound: The 'catkin-pkg==0.5.2' distribution
  was not found and is required by the application

解决办法:

pip install catkin-tools

/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe7 in position 38: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 285, in load_msg_from_file
    text = f.read()
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 38: ordinal not in range(128)
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  
  execute_process(/opt/ws/work/drone_melodic/catkin_ws/build/catkin_generated/env_cached.sh
  "/usr/bin/python3" "/usr/bin/empy" "--raw-errors" "-F"
  "/opt/ws/work/drone_melodic/catkin_ws/build/iking_msg/cmake/iking_msg-genmsg-context.py"
  "-o"
  "/opt/ws/work/drone_melodic/catkin_ws/build/iking_msg/cmake/iking_msg-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  iking_msg/CMakeLists.txt:76 (generate_messages)


-- Configuring incomplete, errors occurred!

解决办法:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8


Traceback (most recent call last):
  File "/opt/ros/melodic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 43, in <module>
    import genmsg.template_tools
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 39, in <module>
    import em
ModuleNotFoundError: No module named 'em'
Traceback (most recent call last):
  File "/opt/ros/melodic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 43, in <module>
    import genmsg.template_tools
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 39, in <module>
    import em
ModuleNotFoundError: No module named 'em'
iking_msg/CMakeFiles/iking_msg_generate_messages_cpp.dir/build.make:125: recipe for target '/opt/ws/work/drone_melodic/catkin_ws/devel/include/iking_msg/iking_fc_rc.h' failed
make[2]: *** [/opt/ws/work/drone_melodic/catkin_ws/devel/include/iking_msg/iking_fc_rc.h] Error 1
make[2]: *** Waiting for unfinished jobs....
iking_msg/CMakeFiles/iking_msg_generate_messages_cpp.dir/build.make:118: recipe for target '/opt/ws/work/drone_melodic/catkin_ws/devel/include/iking_msg/iking_fc_imu.h' failed
make[2]: *** [/opt/ws/work/drone_melodic/catkin_ws/devel/include/iking_msg/iking_fc_imu.h] Error 1
CMakeFiles/Makefile2:3492: recipe for target 'iking_msg/CMakeFiles/iking_msg_generate_messages_cpp.dir/all' failed
make[1]: *** [iking_msg/CMakeFiles/iking_msg_generate_messages_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

解决办法:

pip install empy

  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 77, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: module 'em' has no attribute 'RAW_OPT'
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: module 'em' has no attribute 'RAW_OPT'
    sys.argv, msg_template_map, srv_template_map)

解决办法:

pip uninstall empy
pip install empy==3.3.4
-- ==> add_subdirectory(thrid_lib/mavros-1.8.0/mavros_msgs)
-- Could NOT find geographic_msgs (missing: geographic_msgs_DIR)
-- Could not find the required component 'geographic_msgs'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "geographic_msgs"
  with any of the following names:

    geographic_msgsConfig.cmake
    geographic_msgs-config.cmake

  Add the installation prefix of "geographic_msgs" to CMAKE_PREFIX_PATH or
  set "geographic_msgs_DIR" to a directory containing one of the above files.
  If "geographic_msgs" provides a separate development package or SDK, be
  sure it has been installed.
Call Stack (most recent call first):
  thrid_lib/mavros-1.8.0/mavros_msgs/CMakeLists.txt:4 (find_package)

解决办法:

sudo apt-get install ros-melodic-geographic-msgs

-- Could NOT find libmavconn (missing: libmavconn_DIR)
-- Could not find the required component 'libmavconn'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "libmavconn" with
  any of the following names:

    libmavconnConfig.cmake
    libmavconn-config.cmake

  Add the installation prefix of "libmavconn" to CMAKE_PREFIX_PATH or set
  "libmavconn_DIR" to a directory containing one of the above files.  If
  "libmavconn" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  thrid_lib/mavros-1.8.0/mavros/CMakeLists.txt:7 (find_package)

解决办法:

apt-get install LibMAVConn*

CMake Error at thrid_lib/mavros-1.8.0/mavros/CMakeLists.txt:42 (find_package):
  By not providing "FindGeographicLib.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "GeographicLib", but CMake did not find one.

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

    GeographicLibConfig.cmake
    geographiclib-config.cmake

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


-- Configuring incomplete, errors occurred!

解决办法:

sudo apt-get install ros-melodic-geographic-*
sudo apt-get install geographiclib-*                                                                 
sudo apt-get install libgeographic-*
sudo ln -s /usr/share/cmake/geographiclib/FindGeographicLib.cmake /usr/share/cmake-3.10/Modules/


-- Found OpenCV: /usr (found suitable version "3.2.0", minimum required is "3") found components:  opencv_core opencv_imgproc opencv_imgcodecs 
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (found suitable version "3.6.9", minimum required is "3.6") 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
CMake Error at thrid_lib/cv_bridge/src/CMakeLists.txt:29 (message):
  Could not determine the NumPy include directory, verify that NumPy was
  installed correctly.


-- Configuring incomplete, errors occurred!
See also "/opt/ws/work/drone_melodic/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/opt/ws/work/drone_melodic/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决办法:

pip install numpy(报错,解决办法如下)

  Traceback (most recent call last):
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 59, in process_pyx
      from Cython.Compiler.Version import version as cython_version
  ModuleNotFoundError: No module named 'Cython'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 235, in <module>
      main()
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 231, in main
      find_process_files(root_dir)
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 222, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 188, in process
      processor_function(fromfile, tofile)
    File "/tmp/pip-build-g4dikta4/numpy/tools/cythonize.py", line 64, in process_pyx
      raise OSError('Cython needs to be installed in Python as a module')
  OSError: Cython needs to be installed in Python as a module
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-g4dikta4/numpy/setup.py", line 508, in <module>
      setup_package()
    File "/tmp/pip-build-g4dikta4/numpy/setup.py", line 488, in setup_package
      generate_cython()
    File "/tmp/pip-build-g4dikta4/numpy/setup.py", line 285, in generate_cython
      raise RuntimeError("Running cythonize failed!")
  RuntimeError: Running cythonize failed!
  
  ----------------------------------------
  Failed building wheel for numpy

解决办法:

pip install cython
pip install --upgrade pip setuptools wheel
pip install numpy

-- Could NOT find serial (missing: serial_DIR)
-- Could not find the required component 'serial'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "serial" with any
  of the following names:

    serialConfig.cmake
    serial-config.cmake

  Add the installation prefix of "serial" to CMAKE_PREFIX_PATH or set
  "serial_DIR" to a directory containing one of the above files.  If "serial"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  perip_module_app/CMakeLists.txt:7 (find_package)

解决办法:

apt-get install ros-melodic-serial

-- Found OpenCV: /usr (found version "3.2.0") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'gstreamer-1.0'
--   No package 'gstreamer-1.0' found
CMake Error at /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:419 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
  vision_guide_land/CMakeLists.txt:15 (pkg_check_modules)


-- Configuring incomplete, errors occurred!

解决办法:

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

-- Checking for module 'gstreamer-rtsp-server-1.0'
--   No package 'gstreamer-rtsp-server-1.0' found
CMake Error at /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:419 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
  vision_guide_land/CMakeLists.txt:17 (pkg_check_modules)


-- Configuring incomplete, errors occurred!

解决办法:

sudo apt-get install libgstrtspserver-1.0-dev gstreamer1.0-rtsp

/opt/ws/work/drone_melodic/catkin_ws/src/vision_guide_land/include/tensorrt_yolo/yololayer.h:6:10: fatal error: NvInfer.h: No such file or directory
 #include <NvInfer.h>
          ^~~~~~~~~~~
compilation terminated.
CMake Error at tensorrt_yolov5_generated_yololayer.cu.o.cmake:219 (message):
  Error generating
  /opt/ws/work/drone_melodic/catkin_ws/build/vision_guide_land/CMakeFiles/tensorrt_yolov5.dir/src/tensorrt_yolo/./tensorrt_yolov5_generated_yololayer.cu.o

解决办法:
参考 “5. 安装cuda” 部分。


/opt/ws/work/drone_melodic/catkin_ws/src/vision_guide_land/src/tensorrt_yolo/calibrator.cpp:4:10: fatal error: opencv2/dnn/dnn.hpp: No such file or directory
 #include <opencv2/dnn/dnn.hpp>

解决办法:
参考 “6. 安装opencv”


e package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "mavros_msgs" with
  any of the following names:

    mavros_msgsConfig.cmake
    mavros_msgs-config.cmake

  Add the installation prefix of "mavros_msgs" to CMAKE_PREFIX_PATH or set
  "mavros_msgs_DIR" to a directory containing one of the above files.  If
  "mavros_msgs" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  vision_guide_land/CMakeLists.txt:19 (find_package)

解决办法:

apt-get install ros-melodic-mavros-msgs

/usr/bin/ld: cannot find -lglog
collect2: error: ld returned 1 exit status
vision_guide_land/CMakeFiles/tensorrt_yolov5.dir/build.make:268: recipe for target '/opt/ws/work/drone_melodic/catkin_ws/devel/lib/libtensorrt_yolov5.so' failed
make[2]: *** [/opt/ws/work/drone_melodic/catkin_ws/devel/lib/libtensorrt_yolov5.so] Error 1
CMakeFiles/Makefile2:1378: recipe for target 'vision_guide_land/CMakeFiles/tensorrt_yolov5.dir/all' failed
make[1]: *** [vision_guide_land/CMakeFiles/tensorrt_yolov5.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make install -j8 -l8" failed

解决办法:

sudo apt-get install libgoogle-glog-dev

/usr/bin/ld: warning: libopencv_imgcodecs.so.3.2, needed by /opt/ros/melodic/lib/libcv_bridge.so, may conflict with libopencv_imgcodecs.so.4.5
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /opt/ros/melodic/lib/libcv_bridge.so, may conflict with libopencv_imgproc.so.4.5
/usr/bin/ld: warning: libnvdla_compiler.so, needed by /usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libnvmedia.so, needed by /usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetMaxOutstandingTasks'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerAcquireMetaData'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaEglStreamProducerGetTensor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaDataUnregister'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetOutputTensorDescriptor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `nvdla::destroyNetwork(nvdla::INetwork*)'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `nvdla::createWisdom()'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorGetMetaData'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaRemoveLoadable'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaEglStreamProducerPostTensor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaAppendLoadable'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorGetStatus'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaDataRegister'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaLoadableCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `nvdla::destroyWisdom(nvdla::IWisdom*)'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetInputTensorDescriptor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDeviceDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamConsumerCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaInit'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorLock'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetNumOfInputTensors'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `nvdla::createNetwork()'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaSubmit'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaEglStreamConsumerAcquireTensor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaLoadLoadable'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaEglStreamConsumerReleaseTensor'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetNumEngines'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorEglStreamProducerPostMetaData'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDeviceCreate'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaGetNumOfOutputTensors'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaLoadableDestroy'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaDlaSetCurrentLoadable'
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/libnvinfer.so: undefined reference to `NvMediaTensorUnlock'
collect2: error: ld returned 1 exit status
vision_guide_land/CMakeFiles/vision_land_node.dir/build.make:336: recipe for target '/opt/ws/work/drone_melodic/catkin_ws/devel/lib/vision_guide_land/vision_land_node' failed
make[2]: *** [/opt/ws/work/drone_melodic/catkin_ws/devel/lib/vision_guide_land/vision_land_node] Error 1
CMakeFiles/Makefile2:477: recipe for target 'vision_guide_land/CMakeFiles/vision_land_node.dir/all' failed
make[1]: *** [vision_guide_land/CMakeFiles/vision_land_node.dir/all] Error 2
Makefile:140: recipe for target 'all' failed

解决办法:
这是缺少GPU底层驱动导致,可以将宿主机(Xavier nx)上的/usr/lib/aarch64-linux-gnu/tegra/ 目录,拷贝至docker响应目录即可,也可以使用挂载的方式。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/709800.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

PAT B1011. A+B和C

题目描述 给定区间[-,]内的三个整数A、B和C,请判断AB是否大于C。 输入格式 第一行给出正整数T(≤10),即测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。输出格式 对每组测试用例,如果AB>C,在一行中输出“Case#: true";否则输出“…

13.ChatGPT 大模型训练核心技术

ChatGPT 大模型训练核心技术 从 GPT-3 到 ChatGPT 的大模型训练技术演进 基于RLHF训练大模型的三阶段 • Domain Specific Pre-Training: Fine-tune a pre-trained LLM on raw text with a Causal Language Modelling Objective.• Supervised fine-tuning: Fine-tune the do…

填表统计预约打卡表单系统(FastAdmin+ThinkPHP+UniApp)

填表统计预约打卡表单系统&#xff1a;一键搞定你的预约与打卡需求​ 填表统计预约打卡表单系统是一款基于FastAdminThinkPHPUniApp开发的一款集信息填表、预约报名&#xff0c;签到打卡、活动通知、报名投票、班级统计等功能的自定义表单统计小程序。 &#x1f4dd; 一、引言…

深入解析B树:数据结构、存储结构与算法优势

一、引言 在计算机科学中&#xff0c;数据结构和算法是核心内容。它们的选择和应用直接影响程序的效率和性能。B树&#xff08;B-Tree&#xff09;作为一种自平衡的多叉树数据结构&#xff0c;广泛应用于数据库和文件系统中。本文将详细介绍B树的数据结构模型、存储结构&#…

算法金 | 再见!!!K-means

大侠幸会&#xff0c;在下全网同名「算法金」 0 基础转 AI 上岸&#xff0c;多个算法赛 Top 「日更万日&#xff0c;让更多人享受智能乐趣」 今天我们来聊聊达叔 6 大核心算法之 —— k-means 算法。最早由斯坦福大学的 J. B. MacQueen 于 1967 年提出&#xff0c;后来经过许多…

Liquibase(Oracle SQLcl集成版)简明示例

本文使用的是Oracle SQLcl中集成的Liquibase&#xff0c;而非开源版Liquibase。 Liquibase的快速入门可以参见Liquibase Core Concepts。需要了解一下概念&#xff1a; Change log&#xff1a;基于文本的更改日志文件按顺序列出对数据库所做的所有更改Change set&#xff1a;…

BFD(简单配置实验)

实验拓扑 配置接口IP地址 正常互通 配置静态BFD 查看状态&#xff1a;为UP 与静态路由联动 查看静态路由状态为active 将交换机的接口down掉 BFD的状态为down 再次查看静态路由的状态为Inactive

C++ | Leetcode C++题解之第151题反转字符串中的单词

题目&#xff1a; 题解&#xff1a; class Solution { public:string reverseWords(string s) {int left 0, right s.size() - 1;// 去掉字符串开头的空白字符while (left < right && s[left] ) left;// 去掉字符串末尾的空白字符while (left < right &…

中国首台!紧随美国,重磅发布100比特中性原子量子计算机

2024年6月11日上午&#xff0c;“武汉量子论坛—2024”隆重开幕&#xff0c;国家自然科学基金委员会主任窦贤康院士&#xff0c;武汉大学校长张平文院士&#xff0c;以及叶朝辉、徐红星、祝世宁等院士出席大会。在会议上&#xff0c;中科酷原重磅发布国内首台原子量子计算机——…

安川机器人MA1440减速机维修方法

一、安川机械臂减速器维修方法 1. 齿轮磨损维修 对于轻微磨损的齿轮&#xff0c;可以通过重新调整啮合间隙来恢复性能。对于严重磨损的齿轮&#xff0c;需要更换新安川MA1440机械手齿轮箱齿轮。 2. 轴承损坏维修 对于损坏的轴承&#xff0c;需要更换新的轴承。在更换过程中&…

Dev C++ 安装及使用方法教程-干活多超详细

Dev C 是一款非常好用&#xff0c;简约的C/C开发工具。可以减少很多创建工程的繁琐步骤&#xff0c;很快的进行开发。对于只用于来写代码的人来说&#xff0c;是比较轻量以及极速的。 Dev C 是一个windows下的c和c程序的集成开发环境。它使用mingw32/gcc编译器&#xff0c;遵循…

计算机网络(8) Finite State Machines(有限状态机)

一.建立连接&#xff08;三次握手&#xff09; 建立连接过程中的状态转换如下&#xff1a; 客户端&#xff1a; 发送SYN CLOSED >>>>>>>>>>>>>>SYN SENT(第一次握手) 接收SYNACK发送ACK …

“论面向对象的建模及应用”必过范文,突击2024软考高项论文

论文真题 软件系统建模是软件开发中的重要环节&#xff0c;通过构建软件系统模型可以帮助系统开发人员理解系统&#xff0c;抽取业务过程和管理系统的复杂性&#xff0c;也可以方便各类人员之间的交流。软件系统建模是在系统需求分析和系统实现之间架起的一座桥梁&#xff0c;…

android studio 自定义类注释模版

perferences>File and Code Templates>Class 填写&#xff1a; /*** ClassName: ${ClassName}* Description: ${Description}* Author: ${Author}* CreateDate: ${CreateDate}* UpdateUser: ${UpdateUser}* UpdateDate: ${UpdateDate}* UpdateRemark: ${UpdateRemark}* …

重生之 SpringBoot3 入门保姆级学习(19、场景整合 CentOS7 Docker 的安装)

重生之 SpringBoot3 入门保姆级学习&#xff08;19、场景整合 CentOS7 Docker 的安装&#xff09; 6、场景整合6.1 Docker 6、场景整合 6.1 Docker 官网 https://docs.docker.com/查看自己的 CentOS配置 cat /etc/os-releaseStep 1: 安装必要的一些系统工具 sudo yum insta…

MySQL损坏,使用data恢复数据

MySQL损坏&#xff0c;重装MySQL使用data文件恢复数据库 1.清空相关注册表(清空安装残留)2.下载合适MySQL版本(与损坏数据库版本相同)3.数据恢复4.Windows server MySQL备份bat5.设置Windows定时执行 # 初始化安装 mysqld -install# 查看数据初始化密码 mysqld --initialize --…

Nginx 版本升级方案

因 nginx发现漏洞、需 Nginx 的版本进行更新&#xff0c;需要用到Nginx服务器提供的平滑升级功能。 一、Nginx安装 Linux服务器 离线安装 nginx_linux 离线安装nginx 依赖包 百度云-CSDN博客 二、查看已安装的 Nginx 版本信息&#xff0c;configure 配置信息 ## nginx 目录 /…

C#——结构体详情

结构体 结构体也被称为结构类型&#xff08;“structure type”或“struct type”&#xff09;&#xff0c;它是一种可封装数据和相关功能的值类型&#xff0c;在语法上结构体与类&#xff08;class&#xff09;非常相似&#xff0c;它们都可以用来封装数据&#xff0c;并且都…

泛微开发修炼之旅--15后端开发连接外部数据源,实现在ecology系统中查询其他异构系统数据库得示例和源码

文章链接&#xff1a;15后端开发连接外部数据源&#xff0c;实现在ecology系统中查询其他异构系统数据库得示例和源码

Stable Diffusion 3 Medium 模型

开源SD3&#xff0c;中型版本&#xff0c;20亿参数&#xff0c;Stable Diffusion 3 Medium&#xff0c;系统内存要求32G&#xff0c;显卡6G。 a female character with long, flowing hair that appears to be made of ethereal, swirling patterns resembling the Northern Li…