Uh oh!
There was an error while loading. Please reload this page.
Build/improve llvm development - #51
Conversation
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough在构建脚本与镜像中引入基于 LLVM 的可选工具链与构建参数: Changes
Sequence Diagram(s)sequenceDiagram
participant DevEnv as "触发者"
participant Script as ".script/build-rmcs"
participant Tools as "系统 Clang/LLD 工具"
participant Colcon as "colcon / CMake / Ninja"
DevEnv->>Script: 运行 `build-rmcs`
Script->>Tools: 检查 `clang`, `clang++`, `llvm-ar`, `llvm-ranlib`, `ld.lld`
alt 工具齐全 且 RMCS_USE_GCC != ON
Script->>Tools: 导出 CC/CXX/AR/RANLIB,设置 `-fuse-ld=lld`
Script->>Colcon: 传递 cmake_toolchain_args / cmake_args / colcon_args
Script->>Colcon: 执行带参数的 `colcon build`(CLICOLOR_FORCE=1,清空 NINJA_STATUS)
else 否则
Script->>Colcon: 执行默认 `colcon build`
end
Colcon->>DevEnv: 返回构建结果
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
406cc0f to
009c0a7Comparecreeper5820
commented
Feb 26, 2026
@qzhhhi 老大,审代码 |
qzhhhi
commented
Feb 26, 2026
马上审,我还在修bug |
| update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 && \ | ||
| update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 && \ | ||
| update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-${LLVM_VERSION} 100 && \ | ||
| update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${LLVM_VERSION} 100 && \ |
There was a problem hiding this comment.
下载的包还是显式写出来吧,这样可以看出我们用到了什么
…port - Refactor build-rmcs to use bash arrays for colcon/cmake args - Add complete LLVM toolchain detection (clang, llvm-ar, llvm-ranlib, lld) - Pass absolute paths for CMAKE_AR and CMAKE_RANLIB via command -v - Add RMCS_USE_GCC env var to allow fallback to GCC toolchain - Install lld-22, llvm-ar-22, llvm-ranlib-22 in Dockerfile - Register update-alternatives for lld, llvm-ar, llvm-ranlib
009c0a7 to
a9e1cc5CompareThere was a problem hiding this comment.
🧹 Nitpick comments (1)
.script/build-rmcs (1)
28-32: 考虑添加CMAKE_MODULE_LINKER_FLAGS以保持一致性当前设置了
CMAKE_EXE_LINKER_FLAGS和CMAKE_SHARED_LINKER_FLAGS使用 lld,但 CMake 项目如果生成模块(.so 作为插件加载),可能需要CMAKE_MODULE_LINKER_FLAGS。♻️ 可选修复
cmake_toolchain_args=( "-DCMAKE_AR=$(command -v llvm-ar)" "-DCMAKE_RANLIB=$(command -v llvm-ranlib)" -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld + -DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.script/build-rmcs around lines 28 - 32, 当前 cmake_args 设置只包含 CMAKE_EXE_LINKER_FLAGS 和 CMAKE_SHARED_LINKER_FLAGS 使用 lld,但没有设置 CMAKE_MODULE_LINKER_FLAGS,导致生成作为插件或模块(.so)时可能不会使用 lld;在构造 cmake_args 时为 CMAKE_MODULE_LINKER_FLAGS 添加与 CMAKE_EXE_LINKER_FLAGS/CMAKE_SHARED_LINKER_FLAGS 相同的 lld 链接器标志(例如 -fuse-ld=lld 或项目中已有的变量值),确保 cmake_args 里一并传递该变量以保持可执行、共享库与模块的一致链接行为(参见变量名 cmake_args、CMAKE_MODULE_LINKER_FLAGS、CMAKE_EXE_LINKER_FLAGS、CMAKE_SHARED_LINKER_FLAGS)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.script/build-rmcs:
- Around line 28-32: 当前 cmake_args 设置只包含 CMAKE_EXE_LINKER_FLAGS 和
CMAKE_SHARED_LINKER_FLAGS 使用 lld,但没有设置
CMAKE_MODULE_LINKER_FLAGS,导致生成作为插件或模块(.so)时可能不会使用 lld;在构造 cmake_args 时为
CMAKE_MODULE_LINKER_FLAGS 添加与 CMAKE_EXE_LINKER_FLAGS/CMAKE_SHARED_LINKER_FLAGS
相同的 lld 链接器标志(例如 -fuse-ld=lld 或项目中已有的变量值),确保 cmake_args
里一并传递该变量以保持可执行、共享库与模块的一致链接行为(参见变量名
cmake_args、CMAKE_MODULE_LINKER_FLAGS、CMAKE_EXE_LINKER_FLAGS、CMAKE_SHARED_LINKER_FLAGS)。
79c3ca6 to
7e46a60CompareThere was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.script/complete/_build-rmcs:
- Around line 45-48: The delegated completion function's exit code is being lost
because "${_comp_func}" "$@" is followed by restoring words and CURRENT which
overwrite the shell's last status; modify the flow in the scope around the call
to _comp_func so you capture its exit status (e.g., status=$?) immediately after
invoking "${_comp_func}" "$@", then restore the original variables
words=("${_orig_words[@]}") and CURRENT=${_orig_current}, and finally return or
exit with the saved status (e.g., return $status) so the caller sees the correct
exit code; look for the call site of _comp_func and the restoring assignments to
_orig_words/_orig_current to apply this change.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.script/build-rmcs.script/complete/_build-rmcs
🚧 Files skipped from review as they are similar to previous changes (1)
- .script/build-rmcs
Uh oh!
There was an error while loading. Please reload this page.
7e46a60 to
d122efcCompareThere was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.script/build-rmcs:
- Around line 15-19: The pre-check loop that populates missing_tools (the for
loop iterating over clang clang++ llvm-ar llvm-ranlib ld.lld) omits ninja,
causing a false pass even though CMake later forces the Ninja generator; add
"ninja" to that tool list so the check includes it and will append to
missing_tools if not found.
Uh oh!
There was an error while loading. Please reload this page.
d122efc to
1105c5dCompare
改进 LLVM 开发工具链
概述
本 PR 改进了 RMCS 项目的 LLVM 开发工具链与构建体验:在构建脚本中加入基于可用 LLVM 工具链的自动检测与启用逻辑、为构建命令添加统一的 colcon/CMake 参数化调用与输出控制,在 Dockerfile 中引入可参数化的 LLVM 版本安装与 update-alternatives 注册;同时新增 zsh 命令补全脚本以改善交互体验。
核心改动
1. 构建脚本增强(.script/build-rmcs)
2. Docker 镜像更新(Dockerfile)
3. zsh 补全脚本(.script/complete/_build-rmcs)
影响范围
其它