构建 Catkin (ROS) 失败

Posted

技术标签:

【中文标题】构建 Catkin (ROS) 失败【英文标题】:Building Catkin (ROS) failed 【发布时间】:2018-10-14 23:38:10 【问题描述】:

我正在尝试在我的 Ubuntu 16.04 上安装 ROS 以使用模拟器 Gazebo。首先,我尝试运行一个安装所有内容的脚本,然后在它的末尾出现错误。 所以我决定直接按照他们网站上的说明安装 ROS,但我得到了同样的错误。 然后我按照其他教程,试图找到有同样问题但没有办法的人! 我最后的机会来了。。 我猜出了 CMake 的问题,我使用 python3 并安装了所有必要的库。

sudo catkin build
---------------------------------------------------
Profile:                     default
Extending:                   None
Workspace:                   /home/stribuda
---------------------------------------------------
Build Space:        [exists] /home/stribuda/build
Devel Space:        [exists] /home/stribuda/devel
Install Space:      [unused] /home/stribuda/install
Log Space:          [exists] /home/stribuda/logs
Source Space:       [exists] /home/stribuda/src
DESTDIR:            [unused] None
---------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
---------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
---------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
---------------------------------------------------
NOTE: Forcing CMake to run for each package.
---------------------------------------------------

---------------------------------------------------
WARNING: Your workspace is not extending any other
result space, but it is set to use a `linked`
devel space layout. This requires the `catkin`
CMake package in your source space in order to be
built.
---------------------------------------------------

[build] Found '1' packages in 0.0 seconds.
[build] Package table is up to date.
Warning: generated devel space setup files have been deleted.
Starting  >>> catkin_tools_prebuild
______________________________________________________________________________________________________________________________________________________________________________
Errors     << catkin_tools_prebuild:cmake /home/stribuda/logs/catkin_tools_prebuild/build.cmake.013.log          
CMake Error at /home/stribuda/build/catkin_tools_prebuild/CMakeLists.txt:12 (message):
  The catkin CMake module was not found, but it is required to build a linked
  workspace.  To resolve this, please do one of the following, and try
  building again.



   1. Source the setup.sh file from an existing catkin workspace:
      source SETUP_FILE



   2. Extend another catkin workspace's result (install or devel) space:
      catkin config --extend RESULT_SPACE



   3. Set `catkin_DIR` to the directory containing `catkin-config.cmake`:
      catkin config --cmake-args -Dcatkin_DIR=CATKIN_CMAKE_CONFIG_PATH



   4. Add the catkin source package to your workspace's source space:
      cd SOURCE_SPACE && git clone https://github.com/ros/catkin.git


cd /home/stribuda/build/catkin_tools_prebuild; catkin build --get-env catkin_tools_prebuild | catkin env -si  /usr/bin/cmake /home/stribuda/build/catkin_tools_prebuild --no-warn-    unused-cli -DCATKIN_DEVEL_PREFIX=/home/stribuda/devel/.private/catkin_tools_prebuild -DCMAKE_INSTALL_PREFIX=/home/stribuda/install; cd -
....................................................................................................................................................................
Failed     << catkin_tools_prebuild:cmake          [ Exited with code 1 ]                                                               
Failed    <<< catkin_tools_prebuild                [ 0.0 seconds ]                                                        
Abandoned <<< px4                                  [ Unrelated job failed ]                                                                                   
[build] Summary: 0 of 2 packages succeeded.                                                                                                                     
[build]   Ignored:   None.                                                                                                                                    
[build]   Warnings:  None.                                                                                                                                      
[build]   Abandoned: 1 packages were abandoned.                                                                                                        
[build]   Failed:    1 packages failed.                                                                                                                      
[build] Runtime: 0.1 seconds total

如果有人可以提供帮助,那将非常有帮助!谢谢

更新:

环境 | grep -i ros

ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
LD_LIBRARY_PATH=/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu
PATH=/opt/ros/kinetic/bin:/home/stribuda/gcc-arm-none-eabi-7-2017-q4-major/bin:/home/stribuda/bin:/home/stribuda/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages
PKG_CONFIG_PATH=/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
CMAKE_PREFIX_PATH=/opt/ros/kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

第二次更新: 我重新安装了 ubuntu,我像往常一样按照说明进行操作,在输入 catkin build

后得到了这个
--------------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/kinetic
Workspace:                   /home/stribudax/catkin_ws
--------------------------------------------------------------
Source Space:       [exists] /home/stribudax/catkin_ws/src
Log Space:          [exists] /home/stribudax/catkin_ws/logs
Build Space:        [exists] /home/stribudax/catkin_ws/build
Devel Space:        [exists] /home/stribudax/catkin_ws/devel
Install Space:      [unused] /home/stribudax/catkin_ws/install
DESTDIR:            [unused] None
--------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
--------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
--------------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
--------------------------------------------------------------
Workspace configuration appears valid.
--------------------------------------------------------------
[build] Found '19' packages in 0.0 seconds.                                                                                                                                                               
[build] Package table is up to date.                                                                                                                                                                      
Starting  >>> mav_msgs                                                                                                                                                                                    
Starting  >>> mavlink                                                                                                                                                                                     
Starting  >>> mavros_msgs                                                                                                                                                                                 
Starting  >>> rotors_comm                                                                                                                                                                                 
Finished  <<< rotors_comm                          [ 0.6 seconds ]                                                                                                                                        
Finished  <<< mav_msgs                             [ 0.8 seconds ]                                                                                                                                        
Starting  >>> rotors_description                                                                                                                                                                          
Finished  <<< mavlink                              [ 1.0 seconds ]                                                                                                                                        
Finished  <<< rotors_description                   [ 0.1 seconds ]                                                                                                                                        
Starting  >>> rotors_evaluation                                                                                                                                                                           
Finished  <<< rotors_evaluation                    [ 0.2 seconds ]                                                                                                                                        
Starting  >>> mav_planning_msgs                                                                                                                                                                           
Starting  >>> rotors_control                                                                                                                                                                              
Starting  >>> rotors_joy_interface                                                                                                                                                                        
Finished  <<< mavros_msgs                          [ 1.9 seconds ]                                                                                                                                        
Finished  <<< rotors_joy_interface                 [ 0.6 seconds ]                                                                                                                                        
Finished  <<< rotors_control                       [ 0.8 seconds ]                                                                                                                                        
Starting  >>> libmavconn                                                                                                                                                                                  
Finished  <<< mav_planning_msgs                    [ 0.8 seconds ]                                                                                                                                        
Starting  >>> rqt_rotors                                                                                                                                                                                  
Starting  >>> rotors_gazebo_plugins                                                                                                                                                                       
Finished  <<< libmavconn                           [ 0.2 seconds ]                                                                                                                                        
Starting  >>> mavros                                                                                                                                                                                      
Finished  <<< rqt_rotors                           [ 0.1 seconds ]                                                                                                                                        
__________________________________________________________________________________________________________________________________________________________________________________________________________
Errors     << mavros:cmake /home/stribudax/catkin_ws/logs/mavros/build.cmake.001.log                                                                                                                      
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find GeographicLib (missing: GeographicLib_LIBRARIES
  GeographicLib_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /home/stribudax/catkin_ws/src/mavros/libmavconn/cmake/Modules/FindGeographicLib.cmake:14 (find_package_handle_standard_args)
  CMakeLists.txt:42 (find_package)


cd /home/stribudax/catkin_ws/build/mavros; catkin build --get-env mavros | catkin env -si  /usr/bin/cmake /home/stribudax/catkin_ws/src/mavros/mavros --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/stribudax/catkin_ws/devel/.private/mavros -DCMAKE_INSTALL_PREFIX=/home/stribudax/catkin_ws/install; cd -
..........................................................................................................................................................................................................
Failed     << mavros:cmake                         [ Exited with code 1 ]                                                                                                                                 
Failed    <<< mavros                               [ 0.8 seconds ]                                                                                                                                        
Abandoned <<< mavros_extras                        [ Unrelated job failed ]                                                                                                                               
Abandoned <<< rotors_gazebo                        [ Unrelated job failed ]                                                                                                                               
Abandoned <<< rotors_hil_interface                 [ Unrelated job failed ]                                                                                                                               
Abandoned <<< test_mavros                          [ Unrelated job failed ]                                                                                                                               
__________________________________________________________________________________________________________________________________________________________________________________________________________
Warnings   << rotors_gazebo_plugins:cmake /home/stribudax/catkin_ws/logs/rotors_gazebo_plugins/build.cmake.000.log                                                                                        
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'eigen' but neither 'eigen_INCLUDE_DIRS' nor
  'eigen_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:198 (catkin_package)


CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'gazebo' but neither 'gazebo_INCLUDE_DIRS' nor
  'gazebo_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:198 (catkin_package)


CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'octomap' but neither 'octomap_INCLUDE_DIRS'
  nor 'octomap_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:198 (catkin_package)


CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'opencv' but neither 'opencv_INCLUDE_DIRS' nor
  'opencv_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:198 (catkin_package)


cd /home/stribudax/catkin_ws/build/rotors_gazebo_plugins; catkin build --get-env rotors_gazebo_plugins | catkin env -si  /usr/bin/cmake /home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/stribudax/catkin_ws/devel/.private/rotors_gazebo_plugins -DCMAKE_INSTALL_PREFIX=/home/stribudax/catkin_ws/install; cd -
..........................................................................................................................................................................................................
__________________________________________________________________________________________________________________________________________________________________________________________________________
Warnings   << rotors_gazebo_plugins:make /home/stribudax/catkin_ws/logs/rotors_gazebo_plugins/build.make.000.log                                                                                          
[libprotobuf WARNING google/protobuf/descriptor.cc:5411] Warning: Unused import: "MagneticField.proto" imports "quaternion.proto" which is not used.
/home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp: In member function ‘virtual void gazebo::GeotaggedImagesPlugin::Load(gazebo::sensors::SensorPtr, sdf::ElementPtr)’:
/home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp:83:39: warning: ‘gazebo::common::Time gazebo::rendering::Scene::GetSimTime() const’ is deprecated [-Wdeprecated-declarations]
   lastImageTime_ = scene_->GetSimTime();
                                       ^
In file included from /usr/include/gazebo-7/gazebo/rendering/rendering.hh:40:0,
                 from /home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/include/rotors_gazebo_plugins/external/gazebo_geotagged_images_plugin.h:30,
                 from /home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp:18:
/usr/include/gazebo-7/gazebo/rendering/Scene.hh:639:28: note: declared here
       public: common::Time GetSimTime() const GAZEBO_DEPRECATED(7.0);
                            ^
/home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp: In member function ‘void gazebo::GeotaggedImagesPlugin::OnNewFrame(const unsigned char*)’:
/home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp:161:49: warning: ‘gazebo::common::Time gazebo::rendering::Scene::GetSimTime() const’ is deprecated [-Wdeprecated-declarations]
   common::Time currentTime = scene_->GetSimTime();
                                                 ^
In file included from /usr/include/gazebo-7/gazebo/rendering/rendering.hh:40:0,
                 from /home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/include/rotors_gazebo_plugins/external/gazebo_geotagged_images_plugin.h:30,
                 from /home/stribudax/catkin_ws/src/rotors_simulator/rotors_gazebo_plugins/src/external/gazebo_geotagged_images_plugin.cpp:18:
/usr/include/gazebo-7/gazebo/rendering/Scene.hh:639:28: note: declared here
       public: common::Time GetSimTime() const GAZEBO_DEPRECATED(7.0);
                            ^
cd /home/stribudax/catkin_ws/build/rotors_gazebo_plugins; catkin build --get-env rotors_gazebo_plugins | catkin env -si  /usr/bin/make --jobserver-fds=6,7 -j; cd -
..........................................................................................................................................................................................................
Finished  <<< rotors_gazebo_plugins                [ 53.1 seconds ]                                                                                                                                       
[build] Summary: 12 of 17 packages succeeded.                                                                                                                                                             
[build]   Ignored:   2 packages were skipped or are blacklisted.                                                                                                                                          
[build]   Warnings:  1 packages succeeded with warnings.                                                                                                                                                  
[build]   Abandoned: 4 packages were abandoned.                                                                                                                                                           
[build]   Failed:    1 packages failed.                                                                                                                                                                   
[build] Runtime: 56.0 seconds total.                                                                                                                                                                      
[build] Note: Workspace packages have changed, please re-source setup files to use them.

【问题讨论】:

只是出于好奇的一些问题:你为什么要构建catkin,而你可以在Ubuntu下安装它?你为什么尝试通过 catkin 构建 catkin(我假设 sudo catkin build 是你的 vuild 命令)? 是的,所以为了安装 ROS,我必须安装 catkin,当然还要构建它才能使用 ROS。属于安装步骤! 如果你只是想安装ROS,按照these的步骤,你不需要在Ubuntu下从头开始构建任何东西!那你为什么要建造它呢? 我想在 Gazebo (github.com/intel-aero/meta-intel-aero/wiki/…) 中安装“Intel Aero 模型”,要求按照我发现 catkin build 的说明 (github.com/ethz-asl/rotors_simulator/blob/master/README.md)! 但是你不需要从字面上构建catkin。您只需要按照here 中列出的 1. 和 2. 中的步骤进行操作。然后在你的 catkin 工作区执行catkin_make 【参考方案1】:

在第二个更新中,您的问题是编译需要您没有的库的 Mavros 和凉亭。

在 mavros 文件夹中应该有一个名为 install_GeographicLib.sh 的脚本(或类似的东西)

如果您不想编辑mavros或凉亭的来源,那么我建议使用apt-get安装mavros和凉亭

【讨论】:

以上是关于构建 Catkin (ROS) 失败的主要内容,如果未能解决你的问题,请参考以下文章

ROS环境中的构建错误(catkin)

ROS旋律catkin_make失败

完成 catkin 构建后,ROS Python 脚本不可执行

catkin / ROS:如何在使用子模块时正确指定包含路径

无法使用 catkin_make 构建 ROS 包。对包树感到困惑

在一个 QtCreator 版本中使用 cmake 构建失败,而它与另一个版本以及来自终端的 catkin_make 一起使用