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

在进行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 any
  of the following names:

    std-msgsConfig.cmake
    std-msgs-config.cmake

  Add 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 has
  been 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 init


ERROR: 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/bruce

root@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 roscpp

usage: 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。

你可能感兴趣的:(#,ROS,调试所遇问题)