当前位置: 代码迷 >> 综合 >> CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not
  详细解决方案

CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not

热度:91   发布时间:2023-11-25 01:15:02.0

在进行ROS编译 catkin_make 时,缺少数据包文件 std_msgs

bruce@bruce-desktop:~/catkin_ws$ catkin_make

出现错误

CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):Could not find a package configuration file provided by "std-msgs" with anyof the following names:std-msgsConfig.cmakestd-msgs-config.cmakeAdd the installation prefix of "std-msgs" to CMAKE_PREFIX_PATH or set"std-msgs_DIR" to a directory containing one of the above files.  If"std-msgs" provides a separate development package or SDK, be sure it hasbeen installed.
Call Stack (most recent call first):test_pkg/CMakeLists.txt:10 (find_package)-- Configuring incomplete, errors occurred!
See also "/home/bruce/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/bruce/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

因为缺少文件,(亲测),

从新安装一遍ROS,

不必卸载原来的ROS,再编译,问题解决。

还有遇见的一些主要问题:

问题1:

bruce@bruce-desktop:~$ sudo rosdep initERROR: default sources list file already exists:/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

按要求删除文件

bruce@bruce-desktop:~$ su root
Password: root@bruce-desktop:/home/bruce# pwd
/home/bruceroot@bruce-desktop:/# cd  /etc/ros/rosdep/sources.list.d/
root@bruce-desktop:/etc/ros/rosdep/sources.list.d# ls -l
total 4
-rw-r--r-- 1 root root 588 11月 25 19:11 20-default.list
root@bruce-desktop:/etc/ros/rosdep/sources.list.d# rm 20-default.list
root@bruce-desktop:/etc/ros/rosdep/sources.list.d# 

问题2:

再次创建 test_pkg文件时,出现一些错误,按照提示,删除相应文件即可。

bruce@bruce-desktop:~/catkin_ws$ cd src
bruce@bruce-desktop:~/catkin_ws/src$ catkin_create_pkg test_pkg std_msgs rospy roscppusage: catkin_create_pkg [-h] [--meta] [-s [SYS_DEPS [SYS_DEPS ...]]][-b [BOOST_COMPS [BOOST_COMPS ...]]] [-V PKG_VERSION][-D DESCRIPTION] [-l LICENSE] [-a AUTHOR][-m MAINTAINER] [--rosdistro ROSDISTRO]name [dependencies [dependencies ...]]
catkin_create_pkg: error: File exists: /home/bruce/catkin_ws/src/test_pkg/CMakeLists.txt
bruce@bruce-desktop:~/catkin_ws/src$ 

打开/home/bruce/catkin_ws/src/test_pkg/ ,删除 CMakeLists.txt 文件。有的可能要登录root。

  相关解决方案