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

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

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

      在执行下列命令时

      colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
      出现以下报错
      CMake Error at /home/zhong/moveit2/install/message_generation/share/message_generation/cmake/message_generationConfig.cmake:197 (find_package):
      Could not find a package configuration file provided by "genpy" with any of
      the following names:

      genpyConfig.cmake
      genpy-config.cmake
      

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


      Failed <<< std_msgs [1.85s, exited with code 1]

      Summary: 32 packages finished [27.7s]
      1 package failed: std_msgs
      1 package had stderr output: std_msgs
      7 packages not processed

      在git上下载包genpy后,又显示缺少包
      CMake Error at /home/zhong/moveit2/install/std_msgs/share/std_msgs/cmake/std_msgsConfig.cmake:197 (find_package):
      Could not find a package configuration file provided by "message_runtime"
      with any of the following names:

      message_runtimeConfig.cmake
      message_runtime-config.cmake
      

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


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

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

      下了一个包后,显示缺少另一个包

      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 [2.14s, exited with code 1]

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

      这次下载cppcommon后显示 cmake版本低

      第一次运行colcon时,显示[0/ 24 complete]就中断了,随着下了一些包就变成了[34/41 complete]时中断

      微信图片_20220425173214.png

      原文链接:链接文本

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

        @2519105850 很不幸,经过检索,你所使用的这些包应该都是没有二进制发布的,建议通过源码下载安装。

        比如下面这个cpp_common,就是没有发布foxy版本。

        a866fa9b-4333-4c2f-a15b-8e6d087f3d08-image.png

        具体的包都可以到这个网站查询:

        @小鱼 在 ROS/ROS2功能包在线索引网站 中说:

        推荐语:可以在线搜索ROS2/ROS功能发行情况及依赖信息的网站
        地址:https://index.ros.org/

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

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

          @2519105850 先跑一下rosdep install就好了!

          @小鱼 在 Moveit2探索指南-源码编译测试 中说:

          2.3 安装依赖
          安装依赖时使用了小鱼自己做的rosdepc,如果大家rosdep不好用,也可以尝试尝试小鱼的rosdepc.
          rosdepc install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y

          另外请注意格式哈

          @小鱼 在 提问前必看!一定要看!必须看一下! 中说:

          1. 不要截图,要复制粘贴,一定要代码块包裹
            不要截图的原因是,代码方便回答者去复制帮你搜索,而且无论是在手机上还是电脑上都更容易看。
            用代码块包裹是为了更加美观,不会一个代码很长一段,不易阅读

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

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

            @小鱼 rosdep install 没成功啊,后面是要跟包名吗

            zhong@ubuntu:~$ rosdep install
            Usage: rosdepc [options] <command> <args>

            Commands:

            rosdepc check <stacks-and-packages>...
            check if the dependencies of package(s) have been met.

            rosdepc install <stacks-and-packages>...
            download and install the dependencies of a given package or packages.

            rosdepc db
            generate the dependency database and print it to the console.

            rosdepc init
            initialize rosdepc sources in /etc/ros/rosdep. May require sudo.

            rosdepc keys <stacks-and-packages>...
            list the rosdepc keys that the packages depend on.

            rosdepc resolve <rosdeps>
            resolve <rosdeps> to system dependencies

            rosdepc update
            update the local rosdep database based on the rosdep sources.

            rosdepc what-needs <rosdeps>...
            print a list of packages that declare a rosdep on (at least
            one of) <rosdeps>

            rosdepc where-defined <rosdeps>...
            print a list of yaml files that declare a rosdep on (at least
            one of) <rosdeps>

            rosdepc fix-permissions
            Recursively change the permissions of the user's ros home directory.
            May require sudo. Can be useful to fix permissions after calling
            "rosdepc update" with sudo accidentally.

            rosdepc: error: no packages or stacks specified

            然后我试了试rosdep install cpp_common
            报这个错误zhong@ubuntu:~$ rosdepc install cpp_common

            ERROR: rosdepc cannot find all required resources to answer your query
            Missing resource cpp_common

            😵 😵 😵 😵

            会注意格式的😳

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

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

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

              rosdepc是这样用的。。。。

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

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

                @小鱼 我运行了这句再运行colon还是报一样的错啊

                实在不好意思,我基础太差了😩 😩

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

                  @2519105850 提供一下你的系统信息吧,版本号,ROS版本,我给你写条安装指令。另外可以改一下上面的格式,可以二次编辑的,看着实在难受哈哈。

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

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

                    @小鱼 实在是太感谢了!!!

                    Ubuntu 20.04.4 LTS \n \l

                    ros2foxy ros1 noetic

                    提供完全了吗?

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

                      @2519105850 你用的是foxy吧

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

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

                        @小鱼

                        对的

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

                          @2519105850 很不幸,经过检索,你所使用的这些包应该都是没有二进制发布的,建议通过源码下载安装。

                          比如下面这个cpp_common,就是没有发布foxy版本。

                          a866fa9b-4333-4c2f-a15b-8e6d087f3d08-image.png

                          具体的包都可以到这个网站查询:

                          @小鱼 在 ROS/ROS2功能包在线索引网站 中说:

                          推荐语:可以在线搜索ROS2/ROS功能发行情况及依赖信息的网站
                          地址:https://index.ros.org/

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

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

                            @小鱼
                            非常感谢您!!

                            那就是我按照报错在这个功能包在线索引网站上搜相关包,然后安装在moveit2目录下就可以了吧

                            另外我也想确认下想要实现您写的这篇公众号通过键盘控制机械臂的运动是用Ubuntu20.04 /ros2 foxy吗

                            公众号推送链接: 链接文本

                            小鱼小 1 条回复 最后回复 回复 引用 0
                            • 小鱼小
                              小鱼 技术大佬 @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
                                              • 第一个帖子
                                                最后一个帖子
                                              皖ICP备16016415号-7
                                              Powered by NodeBB | 鱼香ROS