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

    colcon命令的编译清除方法是什么?

    已定时 已固定 已锁定 已移动
    ROS 2相关问题
    colcon 编译清除
    2
    5
    2.7k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 凌云凌
      凌云
      最后由 凌云 编辑

      请问,colcon命令有相关的清除指令吗,像catkin_make那样加clean没有用。或者ROS2有什么新的编译清除方法?

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

        @凌云 肯定有的,colcon是插件式的,每个人都可以开发插件,colcon clean插件如下

        • https://github.com/ruffsl/colcon-clean

        Quick start

        Setup, build and test an example colcon workspace:

        mkdir -p ~/ws/src && cd ~/ws
        wget https://raw.githubusercontent.com/colcon/colcon.readthedocs.org/main/colcon.repos
        vcs import src < colcon.repos
        colcon build
        colcon test
        

        Clean build and install paths for select packages:

        colcon clean packages \
            --base-select \
                build \
                install \
            --packages-select \
                colcon-cmake \
                colcon-package-information
        

        Clean gcov count data files for entire workspace:

        colcon clean workspace \
            --base-select \
                build \
            --clean-match \
              "*.gcda"
        

        Subverbs

        workspace - Clean paths for workspace

        The workspace subverb provides a means to globally clean the top level base paths for the entire workspace.

        packages - Clean paths for packages

        The packages subverb provides a means to locally clean the package level base paths using package selection.

        Clean subverb arguments

        By default, this extension will provide an interactive confirmation prompt with a printout of files to be deleted. This dialogue can be automatically skipped; these deletion events can still be observed via the command's resulting colcon log file.

        • -y, --yes
          • Automatic yes to prompts

        Base handler arguments

        Additional arguments supported by all subverbs provide the option to select which base paths to clean, where they may be relocated:

        • --base-select
          • Select base names to clean in workspace (default: [build, install, log, test_result])
        • --build-base
          • The base path for all build directories (default: build)
        • --install-base
          • The base path for all install directories (default: install)
        • --log-base
          • The base path for all log directories (default: log)
        • --test-result-base
          • The base path for all test_result directories (default: build)

        Clean filter arguments

        Specify what files and directories to include. All files and directories (including symbolic links) are included by default. The --clean-match/--clean-ignore arguments allows for selection using glob/wildcard (".gitignore style") path matching. Paths relative to the root directory (i.e. excluding the name of the root directory itself) are matched against the provided patterns. For example, to only include Gcov Data files, use: colcon clean workspace --clean-match "*.gcda" or to exclude hidden files and directories use: colcon clean workspace --clean-ignore ".*" ".*/" which is short for colcon clean workspace --clean-match "*" "!.*" "!.*/".

        • --clean-match
          • One or several patterns for paths to include. NOTE: patterns with an asterisk must be in quotes ("*") or the asterisk preceded by an escape character (*).
        • --clean-ignore
          • One or several patterns for paths to exclude. NOTE: patterns with an asterisk must be in quotes ("*") or the asterisk preceded by an escape character (*).
        • --clean-no-linked-dirs
          • Do not include symbolic links to other directories.
        • --clean-no-linked-files
          • Do not include symbolic links to files.

        Extension points

        This extension makes use of a number of colcon-core extension points for registering verbs, subverbs with colcon CLI. This extension also provides it's own extension points to support additional cleaning strategies.

        BaseHandlerExtensionPoint

        This extension point determines the types of base paths that may be selected for cleaning. Default base handler extensions provided include:

        • build
          • Note: by default this extension does not follow symlinks
        • install
          • Note: by default this extension does not follow symlinks
        • log
          • Note: logs are stored by time, so package selection is not applicable
        • test_result
          • Note: by default colcon uses build path to store test results

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

        1 条回复 最后回复 回复 引用 0
        • 凌云凌
          凌云
          最后由 编辑

          非常感谢。刚刚我手动删除了install和build文件夹,结果在后续colcon build的时候,出现了一些warning:

          [1.065s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/ling/ros2_ws/install/cpp_pubsub' in the environment variable AMENT_PREFIX_PATH doesn't exist
          [1.066s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/ling/ros2_ws/install/gmc' in the environment variable CMAKE_PREFIX_PATH doesn't exist
          [1.066s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/ling/ros2_ws/install/cpp_pubsub' in the environment variable CMAKE_PREFIX_PATH doesn't exist

          请问这种警告该如何修复?

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

            @凌云 unset一下变量或者,关闭终端重新进入即可

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

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

              @小鱼 已解决,谢谢。

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