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

news2024/11/19 23:18:43

如果搭建的版本高可以参考:
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响应目录即可,也可以使用挂载的方式。

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

逻辑地址 线性地址 物理地址 Linux kernel 内存管理设计

linux kernel 2.6以后的MM&#xff0c;受到了兼容 risc arch cpu 的 MM 的启发&#xff0c;新的 MM 架构对 x86 上任务切换的效率上也有明显提高。 新的MM架构&#xff0c;GDT 不再随着进程的创建与结束而创建和删除 新的表项。 TSS段 也只有一个&#xff0c;进程切换时&…

手持风扇哪个品牌好?五大手持风扇品牌推荐!

随着炎热夏季的到来&#xff0c;手持风扇已成为人们出行的必备清凉神器。然而&#xff0c;面对市场上众多品牌的手持风扇&#xff0c;如何选择一款既时尚又高效的产品成为了许多消费者的难题。为了解决这个困扰&#xff0c;我们精心挑选了五大手持风扇品牌进行推荐。这些品牌不…

STM32 JTAG 模式和 SWD 模式的区别详解

在调试和编程 STM32 微控制器时&#xff0c;使用 JTAG&#xff08;Joint Test Action Group&#xff09;模式和 SWD&#xff08;Serial Wire Debug&#xff09;模式是两种常见的方法。它们在接口需求、调试能力、引脚数量、通信速度等方面各有特点。我们一般采用的的下载器如ST…

Window常用的脚本有哪些?快来看看有哪些是你正在用的!(欢迎评论补充~)

前言 在日常开发中&#xff0c;如果能熟练掌握以下这些使用频率很高的脚本&#xff0c;那工作起来真的是手拿把攥&#xff0c;事半功倍&#xff0c;接下来给大家介绍一些我们日常使用率很高的一些脚本&#xff01; 常用脚本(Batchfile & VBScript) 1.一键启动.bat 一次…

MySQL数据库笔记(二)

第一章 单行函数 1.1 什么是函数 函数的作用是把我们经常使用的代码封装起来,需要的时候直接调用即可。这样既提高了代码效率,又提高了可维护性。在SQL中使用函数,极大地提高了用户对数据库的管理效率。 1.2 定义 操作数据对象。 接受参数返回一个结果。 只对一行进行…

性能工具之 JMeter 常用组件介绍(八)

文章目录 一、Jmeter命令行启动二、Jmeter脚本录制 本文主要介绍JMeter命令行启动和脚本录制功能 一、Jmeter命令行启动 Jmeter有两种运行&#xff1a; 一种是采用的界面模式(GUI&#xff09;启动&#xff0c;会占用不少系统资源&#xff1b;另一种是命令行模式&#xff08;n…

力扣hot100:31. 下一个排列

LeetCode&#xff1a;31. 下一个排列 字典序的大小排序&#xff1a; 从前往后对比&#xff0c;如果先出现更小字符的&#xff0c;字典序更小&#xff0c;如果有个字符串结束了&#xff0c;则它更小。string s "112233"和string t "1122334"&#xff0c;…

训练营第四十二天| 583. 两个字符串的删除操作72. 编辑距离647. 回文子串516.最长回文子序列

583. 两个字符串的删除操作 力扣题目链接(opens new window) 给定两个单词 word1 和 word2&#xff0c;找到使得 word1 和 word2 相同所需的最小步数&#xff0c;每步可以删除任意一个字符串中的一个字符。 示例&#xff1a; 输入: "sea", "eat"输出: …

71. UE5 RPG 实现敌人召唤技能

在这一篇文章中&#xff0c;我们要实现敌人的召唤师能够召唤自己的仆从进行作战。 要实现这个技能&#xff0c;我们首先创建新的敌人蓝图&#xff0c;用于召唤。接着&#xff0c;我们将实现一个召唤技能基类&#xff0c;在基类中实现在召唤师的周围获取到可以生成的位置点&…

数据结构与算法笔记:基础篇 - 分治算法:谈一谈大规模计算框架MapReduce中的分治思想

概述 MapReduce 是 Google 大数据处理的三姐马车之一&#xff0c;另外两个事 GFS 和 Bigtable。它在倒排索引、PageRank 计算、网页分析等搜索引擎相关的技术中都有大量的应用。 尽管开发一个 MapReduce 看起来很高深。实际上&#xff0c;万变不离其宗&#xff0c;它的本质就…

【nginx】 nginx核心功能

【nginx】 nginx核心功能 1.nginx核心功能 1. 反向代理 2. 负载均衡 3. 动静分离 4. nginx的高可用2. 反向代理 正向代理: 该服务器代理的是客户端&#xff0c;对于服务器来说&#xff0c;不知道真实客户端的ip。比如: 翻墙软件。 访问国外的服务器---使用了翻墙软件----对…

响应式高端网站模板源码图库素材 资源下载平台源码

源码介绍 亲测可用&#xff0c;可用于做娱乐网资源网&#xff0c;功能非常的齐全无任何加密也无任何后门&#xff01;响应式高端网站模板源码图库素材 资源下载平台源码&#xff08;可运营&#xff09; 页面很美观&#xff0c;堪比大型网站的美工&#xff0c;而且页面做的也很…

GRIT论文阅读笔记

一篇试图统一生成任务和编码任务的工作&#xff0c;就是把只能完成生成任务的GPT改成既能生成又能encode。思路其实很简单&#xff0c;就是在输入的时候添加instruction tokens来指引模型做representation还是generation&#xff0c;然后各自算损失。representation任务用的是d…

【操作系统】操作系统实验02-生产者消费者程序改进

1. 说明文档中原有程序实现的功能、实现方法。&#xff08;用语言、程序流程图、为原有程序添加注释等方式均可&#xff09; 1.//const.h 2.//定义宏变量 3.#ifndef CONST_H 4.#define CONST_H 5. 6.#define TRUE 1 7.#define FALSE 0 8.#define ERROR 0 9.#define OVERFLOW -…

据阿谱尔APO Research调研显示,2023年全球水凝胶市场销售额约为14.2亿美元

根据阿谱尔 (APO Research&#xff09;的统计及预测&#xff0c;2023年全球水凝胶市场销售额约为14.2亿美元&#xff0c;预计在2024-2030年预测期内将以超过5.0%的CAGR&#xff08;年复合增长率&#xff09;增长。 水凝胶有多种应用&#xff0c;包括个人护理、制药、农业及其他…

界面组件Kendo UI for Angular 2024 Q2亮点 - 让应用程序界面拥有AI提示

随着最新的2024年第二季度发布&#xff0c;Kendo UI for Angular为应用程序开发设定了标准&#xff0c;包括生成式AI集成、增强的设计系统功能和可访问的数据可视化。新的2024年第二季度版本为应用程序界面提供了人工智能(AI)提示&#xff0c;从设计到代码的生产力增强、可访问…

卷积神经网络(CNN)理解

1、引言&#xff08;卷积概念&#xff09; 在介绍CNN中卷积概念之前&#xff0c;先介绍一个数字图像中“边缘检测edge detection”案例&#xff0c;以加深对卷积的认识。图中为大小8X8的灰度图片&#xff0c;图片中数值表示该像素的灰度值。像素值越大&#xff0c;颜色越亮&…

ByteTrack跟踪理解

1.ByteTrack 核心思路 &#xff08;1&#xff09;区分高置信度检测框与低置信度检测框&#xff0c;不同置信度检测框采取不同处理方式。 &#xff08;2&#xff09;保留低置信度检测框&#xff0c;在后续可能会重新确认为 confirm 状态。而不是像传统 MOT 算法选择删除。 2.…

视频行人搜索 (Person Search in Videos)

文章目录 视频行人搜索 (Person Search in Videos)图像行人搜索存在问题Video PS 定义MTA-PS数据集First person search dataset in videosComplicated ambient conditions and realistic monitoring scenariosPrivacy insensitivity 方法 视频行人搜索 (Person Search in Vide…

Nacos从入门到实战

一、Nacos介绍 1.什么是Nacos 官方&#xff1a;一个更易于构建云原生应用的动态服务发现&#xff08;Nacos Discovery&#xff09;、服务配置&#xff08;Nacos Config&#xff09;和服务管理平台 集 注册中心配置中心服务管理 平台 注册中心&#xff1a;把所有的服务注册进去…