鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    ros2使用colcon编译时,总是报错提示缺少一个包,安装完一个后还有另一个

    已定时 已固定 已锁定 已移动 已解决
    综合问题
    ros2 colcon moveit
    2
    34
    7.4k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 小鱼小
      小鱼 技术大佬 @2519105850
      最后由 编辑

      @2519105850 是的,采用的是ubuntu20.04-ros:foxy实现。

      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

      25191058502 2 条回复 最后回复 回复 引用 0
      • 25191058502
        2519105850 @小鱼
        最后由 编辑

        @小鱼 好的,非常感谢!🙂

        1 条回复 最后回复 回复 引用 0
        • 小鱼小 小鱼 将这个主题标记为已解决,在
        • 25191058502
          2519105850 @小鱼
          最后由 编辑

          @小鱼 您好,在头一次运行colcon报错提示缺少cpp_common

          CMake Warning (dev) at CMakeLists.txt:2 (project):
          Policy CMP0048 is not set: project() command manages VERSION variables.
          Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
          command to set the policy and suppress this warning.

          The following variable(s) would be set to empty:

          CMAKE_PROJECT_VERSION
          CMAKE_PROJECT_VERSION_MAJOR
          CMAKE_PROJECT_VERSION_MINOR
          CMAKE_PROJECT_VERSION_PATCH
          

          This warning is for project developers. Use -Wno-dev to suppress it.

          CMake Error at /home/zhong/moveit2/install/message_runtime/share/message_runtime/cmake/message_runtimeConfig.cmake:197 (find_package):
          Could not find a package configuration file provided by "cpp_common" with
          any of the following names:

          cpp_commonConfig.cmake
          cpp_common-config.cmake
          

          Add the installation prefix of "cpp_common" to CMAKE_PREFIX_PATH or set
          "cpp_common_DIR" to a directory containing one of the above files. If
          "cpp_common" provides a separate development package or SDK, be sure it has
          been installed.
          Call Stack (most recent call first):
          /home/zhong/moveit2/install/std_msgs/share/std_msgs/cmake/std_msgsConfig.cmake:197 (find_package)
          /home/zhong/moveit2/install/catkin/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
          CMakeLists.txt:3 (find_package)


          Failed <<< test_msgs [0.54s, exited with code 1]

          Summary: 35 packages finished [8.20s]
          1 package failed: test_msgs
          1 package had stderr output: test_msgs
          6 packages not processed

          我在https://github.com/chronoxor/CppCommon上下载这个包到moveit2这个文件夹里,然后又报这个错误😩

          If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
          If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

          If you understand the risks and want to override a package anyways, add the following to the command line:
          --allow-overriding ament_cmake ament_cmake_auto ament_cmake_core ament_cmake_gmock ament_cmake_gtest ament_cmake_pytest ament_cmake_ros ament_cmake_test rclcpp rclcpp_action rclcpp_components rclcpp_lifecycle std_msgs test_msgs

          This may be promoted to an error in a future release of colcon-override-check.
          Starting >>> ament_package
          Starting >>> catkin
          Starting >>> domain_coordinator
          Starting >>> cppcommon
          --- stderr: cppcommon
          CMake Error: The source "/home/zhong/moveit2/CppCommon/CMakeLists.txt" does not match the source "/home/zhong/moveit2/CppCommon-master/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.

          Failed <<< cppcommon [0.64s, exited with code 1]
          Aborted <<< catkin [0.70s]
          Aborted <<< domain_coordinator [1.32s]
          Aborted <<< ament_package [1.40s]

          Summary: 0 packages finished [2.08s]
          1 package failed: cppcommon
          3 packages aborted: ament_package catkin domain_coordinator
          1 package had stderr output: cppcommon
          39 packages not processed

          运行colcon后直接就中断结束了,这个该怎样处理呢?

          小鱼小 1 条回复 最后回复 回复 引用 0
          • 小鱼小
            小鱼 技术大佬 @2519105850
            最后由 编辑

            @2519105850 兄弟你先改下格式

            新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

            25191058502 1 条回复 最后回复 回复 引用 0
            • 25191058502
              2519105850 @小鱼
              最后由 编辑

              @小鱼 好的,不好意思添麻烦了,下面这个格式是较正确的吗?

              运行colcon命令报错提示缺少cpp_common

              colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
              
              CMake Warning (dev) at CMakeLists.txt:2 (project):
              Policy CMP0048 is not set: project() command manages VERSION variables.
              Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
              command to set the policy and suppress this warning.
              
              The following variable(s) would be set to empty:
              
              CMAKE_PROJECT_VERSION
              CMAKE_PROJECT_VERSION_MAJOR
              CMAKE_PROJECT_VERSION_MINOR
              CMAKE_PROJECT_VERSION_PATCH
              This warning is for project developers. Use -Wno-dev to suppress it.
              
              CMake Error at /home/zhong/moveit2/install/message_runtime/share/message_runtime/cmake/message_runtimeConfig.cmake:197 (find_package):
              Could not find a package configuration file provided by "cpp_common" with
              any of the following names:
              
              cpp_commonConfig.cmake
              cpp_common-config.cmake
              Add the installation prefix of "cpp_common" to CMAKE_PREFIX_PATH or set
              "cpp_common_DIR" to a directory containing one of the above files. If
              "cpp_common" provides a separate development package or SDK, be sure it has
              been installed.
              Call Stack (most recent call first):
              /home/zhong/moveit2/install/std_msgs/share/std_msgs/cmake/std_msgsConfig.cmake:197 (find_package)
              /home/zhong/moveit2/install/catkin/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
              CMakeLists.txt:3 (find_package)
              
              Failed <<< test_msgs [0.54s, exited with code 1]
              
              Summary: 35 packages finished [8.20s]
              1 package failed: test_msgs
              1 package had stderr output: test_msgs
              6 packages not processed
              

              我在https://github.com/chronoxor/CppCommon上 下载cpp_common这个包到moveit2这个文件夹里,然后报了下面这个错误:

              If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
              If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.
              
              If you understand the risks and want to override a package anyways, add the following to the command line:
              --allow-overriding ament_cmake ament_cmake_auto ament_cmake_core ament_cmake_gmock ament_cmake_gtest ament_cmake_pytest ament_cmake_ros ament_cmake_test rclcpp rclcpp_action rclcpp_components rclcpp_lifecycle std_msgs test_msgs
              
              This may be promoted to an error in a future release of colcon-override-check.
              Starting >>> ament_package
              Starting >>> catkin
              Starting >>> domain_coordinator
              Starting >>> cppcommon
              --- stderr: cppcommon
              CMake Error: The source "/home/zhong/moveit2/CppCommon/CMakeLists.txt" does not match the source "/home/zhong/moveit2/CppCommon-master/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
              Failed <<< cppcommon [0.64s, exited with code 1]
              Aborted <<< catkin [0.70s]
              Aborted <<< domain_coordinator [1.32s]
              Aborted <<< ament_package [1.40s]
              
              Summary: 0 packages finished [2.08s]
              1 package failed: cppcommon
              3 packages aborted: ament_package catkin domain_coordinator
              1 package had stderr output: cppcommon
              39 packages not processed
              

              运行colcon命令后直接就中断结束了,请问这个该怎样解决呢?

              小鱼小 1 条回复 最后回复 回复 引用 0
              • 小鱼小
                小鱼 技术大佬 @2519105850
                最后由 编辑

                @2519105850 通过检索发现,cpp_common是ros的核心包 https://github.com/ros/roscpp_core 里的。
                而你是ROS2,应该是不需要这个包的,请你再次确认代码版本,系统版本,ROS版本。

                moveit2的教程可以看看我之前写的,都是没有这个步骤和问题的。

                Moveit2探索指南-源码编译测试

                新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                25191058502 1 条回复 最后回复 回复 引用 0
                • 25191058502
                  2519105850 @小鱼
                  最后由 编辑

                  @小鱼 那就说明我多半版本安装错误?

                  小鱼小 1 条回复 最后回复 回复 引用 0
                  • 小鱼小
                    小鱼 技术大佬 @2519105850
                    最后由 编辑

                    @2519105850 是的,你应该是代码版本不对,我刚再次检查了下我的环境,cpp_common只在ros1中有,你的代码如果是ros2的,按理不应该出现。

                    新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                    25191058502 2 条回复 最后回复 回复 引用 0
                    • 25191058502
                      2519105850 @小鱼
                      最后由 编辑

                      @小鱼 好的,非常感谢!!!

                      1 条回复 最后回复 回复 引用 0
                      • 25191058502
                        2519105850 @小鱼
                        最后由 编辑

                        @小鱼 确实是我版本号的问题,真是太厉害了!

                        我运行colon命令,然后提示只要下两个包,下第二个的时候报错了

                        colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
                        

                        报错内容

                        CMake Error at CMakeLists.txt:19 (find_package):
                          By not providing "Findmoveit_visual_tools.cmake" in CMAKE_MODULE_PATH this
                          project has asked CMake to find a package configuration file provided by
                          "moveit_visual_tools", but CMake did not find one.
                        
                          Could not find a package configuration file provided by
                          "moveit_visual_tools" with any of the following names:
                        
                            moveit_visual_toolsConfig.cmake
                            moveit_visual_tools-config.cmake
                        
                          Add the installation prefix of "moveit_visual_tools" to CMAKE_PREFIX_PATH
                          or set "moveit_visual_tools_DIR" to a directory containing one of the above
                          files.  If "moveit_visual_tools" provides a separate development package or
                          SDK, be sure it has been installed.
                        
                        
                        ---
                        Failed   <<< moveit2_tutorials [16.1s, exited with code 1]
                        
                        Summary: 1 package finished [1min 24s]
                          1 package failed: moveit2_tutorials
                          1 package had stderr output: moveit2_tutorials
                        
                        

                        是因为我用二进制安装moveit2没成功吗?
                        运行的这个代码

                        sudo apt install ros-foxy-moveit
                        sudo apt install ros-foxy-joint-state-controller
                        

                        这是结果(没报错吧)

                        zhong@ubuntu:~$ sudo apt install ros-foxy-moveit
                        [sudo] zhong 的密码: 
                        正在读取软件包列表... 完成
                        正在分析软件包的依赖关系树       
                        正在读取状态信息... 完成       
                        ros-foxy-moveit 已经是最新版 (2.2.3-1focal.20220209.173642)。
                        升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
                        zhong@ubuntu:~$ sudo apt install ros-foxy-joint-state-controller
                        正在读取软件包列表... 完成
                        正在分析软件包的依赖关系树       
                        正在读取状态信息... 完成       
                        ros-foxy-joint-state-controller 已经是最新版 (0.7.0-1focal.20220223.161450)。
                        升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
                        

                        然后我就在 https://moveit.ros.org/install-moveit2/source/ 上按照步骤运行

                        运行到下面这一步时报错了,但是我接着运行后面一步没有管它

                        zhong@ubuntu:~/ws_moveit2/src$ vcs import < moveit2/moveit2.repos
                        
                        Command 'vcs' not found, but there are 15 similar ones.
                        

                        当运行下面这个命令时,

                        colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release
                        

                        报了这个错误

                        --- stderr: moveit_planners_ompl
                        c++: fatal error: 已杀死 signal terminated program cc1plus
                        compilation terminated.
                        make[2]: *** [ompl_interface/CMakeFiles/moveit_ompl_interface.dir/build.make:284:ompl_interface/CMakeFiles/moveit_ompl_interface.dir/src/detail/constrained_sampler.cpp.o] 错误 1
                        make[1]: *** [CMakeFiles/Makefile2:187:ompl_interface/CMakeFiles/moveit_ompl_interface.dir/all] 错误 2
                        make: *** [Makefile:141:all] 错误 2
                        ---
                        Failed   <<< moveit_planners_ompl [6min 9s, exited with code 2]
                        Aborted  <<< moveit_ros_move_group [5min 26s]
                        
                        Summary: 14 packages finished [8min 33s]
                          1 package failed: moveit_planners_ompl
                          1 package aborted: moveit_ros_move_group
                          1 package had stderr output: moveit_planners_ompl
                          10 packages not processed
                        
                        小鱼小 1 条回复 最后回复 回复 引用 0
                        • 小鱼小
                          小鱼 技术大佬 @2519105850
                          最后由 编辑

                          @2519105850 在 ros2使用colcon编译时,总是报错提示缺少一个包,安装完一个后还有另一个 中说:

                          Command 'vcs' not found, but there are 15 similar ones.

                          你去看一下我的教程,你这个连vcs都没装怎么用

                          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                          25191058502 1 条回复 最后回复 回复 引用 0
                          • 25191058502
                            2519105850 @小鱼
                            最后由 编辑

                            @小鱼 我现在发现好像是我rosdepc这一步错了导致 colcon错误

                            
                            rosdepc install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
                            

                            运行这一步时报了 moveit_visual_tools 相关的错误(之前几次没显示这个错误)

                            ERROR: the following packages/stacks could not have their rosdepc keys resolved
                            to system dependencies:
                            moveit2_tutorials: Cannot locate rosdep definition for [moveit_visual_tools]
                            Continuing to install resolvable dependencies...
                            #All required rosdeps installed successfully
                            

                            之前就只有成功那句

                            另外运行这句指令时,报了这个错误

                            
                            git reset 59cf8c49bb309e2bb7f06e295f87efa36f8bb506 --hard
                            
                            fatal: 不能解析对象 '59cf8c49bb309e2bb7f06e295f87efa36f8bb506'。
                            
                            
                            小鱼小 1 条回复 最后回复 回复 引用 0
                            • 小鱼小
                              小鱼 技术大佬 @2519105850
                              最后由 编辑

                              @2519105850 在 ros2使用colcon编译时,总是报错提示缺少一个包,安装完一个后还有另一个 中说:

                              moveit_visual_tools

                              rosdep这个没关系,手动下载一下到src下

                              git clone https://github.com/ros-planning/moveit_visual_tools.git -b foxy
                              

                              新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                              25191058502 1 条回复 最后回复 回复 引用 0
                              • 25191058502
                                2519105850 @小鱼
                                最后由 编辑

                                @小鱼 感觉又和之前那样

                                src目录下了moveit_visual_tools包后,再运行下面这个代码

                                colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
                                

                                提示我graph这个包没有,在 https://github.com/PickNikRobotics/graph_msgs.git 上下载包到src目录下再运行 colcon命令

                                然后提示缺少catkin

                                --- stderr: graph_msgs                                         
                                CMake Error at CMakeLists.txt:7 (find_package):
                                  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
                                  asked CMake to find a package configuration file provided by "catkin", but
                                  CMake did not find one.
                                
                                  Could not find a package configuration file provided by "catkin" with any
                                  of the following names:
                                
                                    catkinConfig.cmake
                                    catkin-config.cmake
                                
                                  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
                                  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
                                  provides a separate development package or SDK, be sure it has been
                                  installed.
                                

                                我在 https://index.ros.org/ 搜索 cakin 也没找到foxy下的包,catkin也是ros1的包吧?
                                😞

                                小鱼小 1 条回复 最后回复 回复 引用 0
                                • 小鱼小
                                  小鱼 技术大佬 @2519105850
                                  最后由 编辑

                                  @2519105850 应该是的,你的代码到底哪来的

                                  新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                  25191058502 1 条回复 最后回复 回复 引用 0
                                  • 25191058502
                                    2519105850 @小鱼
                                    最后由 编辑

                                    @小鱼 我开始使用的是Ubuntu18.04,然后换了20.04,就按照公众号的这篇文章
                                    https://mp.weixin.qq.com/s/yfMKYtRpRF6xF2PjtGSFzg
                                    (应该是一步步执行的)

                                    会不会是下载ros2的时候一些包没下上,一些需要的包没配置?我同时下了rosfoxy , noetic,前面由于我打开终端选择的是noetic然后跟着文章执行的时候colcon报了缺少各种包的错;后面我就把moveit2的那个包全删了,打开终端时选择foxy,运行到colcon时显示
                                    [1/2 complete] (我以为这就要成功了,结果显示没 那个tool😥 )

                                    小鱼小 1 条回复 最后回复 回复 引用 0
                                    • 小鱼小
                                      小鱼 技术大佬 @2519105850
                                      最后由 编辑

                                      @2519105850 你可能下载的某个包并没有切换分支,还在ros上,比如你这个graph_msgs

                                      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                      25191058502 2 条回复 最后回复 回复 引用 0
                                      • 25191058502
                                        2519105850 @小鱼
                                        最后由 编辑

                                        @小鱼 我选择了foxy这个后那个终端就没有关了,一直接着后面操作的

                                        我再把这个moveit2包删了,运行一步关闭一个终端选择一次foxy,但愿不报错,报错能解决也行🤕

                                        1 条回复 最后回复 回复 引用 0
                                        • 25191058502
                                          2519105850 @小鱼
                                          最后由 编辑

                                          @小鱼 您好,我使用

                                          sudo apt-get purge ros-*
                                          sudo apt-get autoremove
                                          

                                          卸载foxy 和 neotic
                                          为什么打开终端还有提示让我选择呢,是我没卸载干净吗
                                          7422480a-c0d2-43ba-b95d-eeaf2c3d5ea5-image.png

                                          安装foxy感觉也没成功
                                          bf35b2cc-ae48-4a0e-a174-d8d2062fec31-image.png

                                          小鱼小 1 条回复 最后回复 回复 引用 0
                                          • 小鱼小
                                            小鱼 技术大佬 @2519105850
                                            最后由 编辑

                                            @2519105850 在 ros2使用colcon编译时,总是报错提示缺少一个包,安装完一个后还有另一个 中说:

                                            卸载foxy 和 neotic
                                            为什么打开终端还有提示让我选择呢,是我没卸载干净吗

                                            卸载干净了,配置没有清除罢了,你先用一键安装继续装,一键安装会帮你配置好的

                                            @小鱼 在 小鱼的一键安装系列 中说:

                                            一键安装指令
                                            wget http://fishros.com/install -O fishros && . fishros

                                            新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                            25191058502 1 条回复 最后回复 回复 引用 0
                                            • 第一个帖子
                                              最后一个帖子
                                            皖ICP备16016415号-7
                                            Powered by NodeBB | 鱼香ROS