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

如果搭建的版本高可以参考:
https://gitlab.com/nvidia/container-images/l4t-jetpack.git
如果版本比较低,按照下面的步骤进行操作:
使用的硬件平台为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
  3. 安装docker buildx: sudo apt install docker-buildx && docker buildx install

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/722361.html

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

相关文章

【CVPR2024】面向StableDiffusion的编辑算法FreePromptEditing,提升图像编辑效果

近日&#xff0c;阿里云人工智能平台PAI与华南理工大学贾奎教授团队合作在深度学习顶级会议 CVPR2024 上发表 FPE(Free-Prompt-Editing) 算法&#xff0c;这是一种面向StableDiffusion的图像编辑算法。在这篇论文中&#xff0c;StableDiffusion可用于实现图像编辑的本质被挖掘&…

智慧之光照亮黑暗矿井:揭秘未来矿山的智能化革命

1. 煤矿行业背景概述 1.1 煤矿行业产能概述 截至2018年底&#xff0c;全国安全生产许可证等证照齐全的生产煤矿3373处&#xff0c;产能35.3亿吨/年。 已核准&#xff08;审批&#xff09;、开工建设煤矿1010处&#xff0c;产能10.3亿吨/年。 13个亿吨级煤炭能源基地&#xf…

Vulnhub——AI: WEB: 1

渗透复现 &#xff08;1&#xff09;目录扫描爆破出隐藏页面info.php和传参页面&#xff0c;泄露网站绝对路径并且存在SQL注入点 &#xff08;2&#xff09;已知网站绝对路径&#xff0c;存在SQL注入点&#xff0c;尝试OS-shell写入 &#xff08;3&#xff09;OS-shell写入后…

数据库:与红黑树不同的延迟序列

在内存里维护一个序列&#xff0c;可能第一个想到的就是红黑树。但是&#xff0c;红黑树算法复杂&#xff0c;这还不是主要的&#xff0c;主要的问题是&#xff1a;红黑树的空间利用率低。 红黑树的空间利用率 一个红黑树的节点&#xff0c;包括父节点指针、两个子节点指针、…

集团门户网站的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;管理员管理&#xff0c;论坛管理&#xff0c;集团文化管理&#xff0c;基础数据管理&#xff0c;公告通知管理 前台账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;论坛&#xff0…

python小白兔做操 青少年编程电子学会python编程等级考试三级真题解析2021年12月

python小白兔做操 2021年12月 python编程等级考试级编程题 一、题目要求 1、编程实现 小白兔们每天早上都到草坪上做早操。做操前&#xff0c;首先要按照身高由矮到高排个队&#xff0c;下列代码实现了排队的功能。首先读取小白兔的只数&#xff0c;然后读取每只小白兔的身…

鸿蒙实现金刚区效果

前言&#xff1a; DevEco Studio版本&#xff1a;4.0.0.600 所谓“金刚区"是位于APP功能入口的导航区域&#xff0c;通常以“图标文字”的宫格导航的形式出现。之所以叫“金刚区”&#xff0c;是因为该区域会随着业务目标的改变&#xff0c;展示不同的功能图标&#xff…

Android OTA 升级基础知识详解+源码分析

前言&#xff1a; 本文仅仅对OTA升级的几种方式的概念和运用进行总结&#xff0c;仅在使用层面对其解释。需要更详细的内容我推荐大神做的全网最详细的讲解&#xff1a; https://blog.csdn.net/guyongqiangx/article/details/129019303?spm1001.2014.3001.5502 三种升级方式…

ubuntu的home内存不足的解决办法(win和ubuntu双系统)

这种解决办法前提是windows和ubuntu双系统 首先在windows系统上创建一个空的硬盘分区 然后在ubuntu系统上把这个空的硬盘放在主目录里 然后可以把东西存在这个文件夹中 如下图&#xff0c;但实际主目录的内存没有变&#xff0c;以后存东西就在这个文件夹里面就好了 具体操作…

【Gradio】Chatbots 如何用 Gradio 创建聊天机器人

Creating A Chatbot Fast 简介 聊天机器人是大型语言模型的一个流行应用。使用 gradio &#xff0c;您可以轻松构建您的聊天机器人模型的演示&#xff0c;并与您的用户分享&#xff0c;或者使用直观的聊天机器人用户界面自己尝试。 本教程使用 gr.ChatInterface() &#xff0c;…

「51媒体」总台,地方卫视媒体邀约新闻报道采访怎么做?

传媒如春雨&#xff0c;润物细无声&#xff0c;大家好&#xff0c;我是51媒体网胡老师。 总台对选题要求非常严格&#xff0c;在想做总台新闻报道之前&#xff0c;让我们先来了解下总台对新闻选题有哪些要求&#xff1a; 一、新闻价值 社会意义&#xff1a;新闻报道的首要任务…

【电源开发】输出电压纹波

输出电压纹波是什么 电压纹波指的是直流输出电压中一个交流部分 减小输出电压纹波的方法 调整输出端的电容值 提高开关电源的工作频率

R语言做图

目录 1. 图形参数 2. 低级图形 3. 部分高级图形 参考 1. 图形参数 图形参数用于设置图形中各种属性。 有些参数直接用在绘图函数内&#xff0c;如plot函数可以用 pch&#xff08;点样式&#xff09;、col&#xff08;颜色&#xff09;、cex&#xff08;文字符号大小倍数&…

Android SurfaceFlinger——概述(一)

一、基础介绍 SurfaceFlinger 是 Android 系统中的一个关键组件&#xff0c;负责管理屏幕显示的合成和渲染。 服务角色&#xff1a;SurfaceFlinger 作为一个系统服务独立运行&#xff0c;它不依赖于任何应用程序进程&#xff0c;而是由系统启动并持续运行。窗口管理&#xff1a…

用Flask定制指令上传Excel数据到数据库

用Flask定制指令上传Excel数据到数据库 假设现在有一张员工信息data.xlsx文件 使用SQLAlchemy创表 # ExcelModel.py from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import DeclarativeBaseclass Base(DeclarativeBase):passclass Emp(…

《Windows API每日一练》4.6 矩形、区域和裁剪

在前面的4.3节中我们讲述了绘制矩形的API函数Rectangle和RoundRect。本节我们将介绍另外一组使用RECT矩形结构和区域的绘图函数。 本节必须掌握的知识点&#xff1a; 矩形 第28练&#xff1a;绘制随机矩形 矩形与区域的裁剪 第29练&#xff1a;区域裁剪 4.6.1 矩形 ■FillRe…

2025年计算机毕业设计题目参考-简单容易

2025年最新计算机毕业设计题目参考-第二批 以下可以参考 企业员工薪酬关系系统的设计 基于SpringBoot在线远程考试系统 SpringBootVue的乡政府管理系统 springboot青年公寓服务平台 springboot大学生就业需求分析系统 基于Spring Boot的疗养院管理系统 基于SpringBoot的房屋交…

堆优化版Dijkstra求最短路-java

主要通过堆优化Dijkstra算法解决最短路&#xff0c;可以跟朴素版的Dijkstra算法进行对比。 文章目录 前言 一、Dijkstra求最短路 二、算法思路 1.邻接表存储图 2.用小根堆优化Dijkstra 三、代码如下 1.代码如下&#xff08;示例&#xff09;&#xff1a; 2.读入数据 3.代码运行…

高压线防外破警示灯在电力安全发挥的作用_鼎跃安全

高压输电线路往往跨越城市、乡村和野外&#xff0c;覆盖范围广泛。随着城乡建设和交通运输的快速发展&#xff0c;高压线路周围的活动频繁&#xff0c;外部破坏风险增加。车辆撞击电线杆、施工机械误碰线路以及人为破坏等事件时有发生&#xff0c;严重影响电力供应的稳定性和安…

人工智能--自然语言处理NLP概述

欢迎来到 Papicatch的博客 目录 &#x1f349;引言 &#x1f348;基本概念 &#x1f348;核心技术 &#x1f348;常用模型和方法 &#x1f348;应用领域 &#x1f348;挑战和未来发展 &#x1f349;案例分析 &#x1f348;机器翻译中的BERT模型 &#x1f348;情感分析在…