docs: 对齐 build/bin 布局、日志自动落盘、env_common 探测库与 tools 精简

This commit is contained in:
mzx committed 2026-11-21 23:32:47 +08:00
1 parent 0843c6ade0
commit 3c58a08dad
47 files changed
+1063 -2009

No files matched your search

+20 -3
View File
@@ -94,8 +94,8 @@ add_linkgroups(libs, {group = true}) -- → -Wl,--start-group … -Wl,--end-
| 失去的东西 | 现在的替代做法 |
|---|---|
| `ros2 run sentry_nav self_filter` | 直接跑 `build/linux/x86_64/release/self_filter` |
| `ros2 run sentry_sim odom_tf.py` | `build/linux/x86_64/release/odom_tf` |
| `ros2 run sentry_nav self_filter` | 直接跑 `build/bin/self_filter` |
| `ros2 run sentry_sim odom_tf.py` | `build/bin/odom_tf` |
| `ros2 pkg prefix sentry_sim` | `SENTRY_SIM_SHARE` 环境变量(默认 `<仓库>/src/sentry_sim`) |
| `xacro` 的 `$(find sentry_sim)` | 改成 `$(env SENTRY_SIM_SHARE)`;不设变量会明确报错 |
| `ros2 launch sentry_sim …`(备用入口) | 只保留 `scripts/sentry_up.sh`(本来就是主入口) |
@@ -187,7 +187,24 @@ src/sentry_nav/
| `cannot find -lxxx` | 那个包是 header-only | 用 `os.isfile()` 过滤,别直接 `add_links` |
| `xmake test` 报 `invalid task: run_tests` | 老写法 | 用 **`xmake test`** |
| `xmake test xxx` 显示 `nothing to test` | 用例名是 `<target>/<testname>` | **`xmake test test_xxx/default`** |
| `attempt to index a nil value (local 't')` | 公共配置函数带了参数 | 改成无参,在 `target()` 块内调用 |
| `attempt to index a nil value (local 't')` | 公共配置函数带了参数,或想在 `target()` 块**外面**拿目标实例 | xmake 的 API **只在 `target()` 块内部有效**。`target(name)` 也**不返回实例**(返回 nil),所以写不出 `set_targetdir` 的包装函数 |
| VS Code 报 `xxx.hpp file not found` | 根 `compile_commands.json` 过期 | 跑一次 `xmake`,再重启 clangd |
### 7.1 产物目录固定成 `build/bin/`
**结论**:每个 target 里写一行 `set_targetdir("$(builddir)/bin")`,**不用 xmake 默认的
`build/<平台>/<架构>/<模式>/`**。
**为什么**:那串平台三元组(`build/linux/x86_64/release/…`)会被抄进文档、脚本、
报错提示里。换架构 / 换 OS / 换 release↔debug,**全仓 29 处引用一起失效** ——
本工程已经在这上面翻过一次车。固定成 `build/bin/` 后,文档里可以永远写
`build/bin/nav_client`。
**代价**:release 和 debug 落同一层、互相覆盖。要并行保留就用 `xmake -o <目录>`。
**⚠️ 新增 target 时必须自己补那一行**,否则它会掉回默认目录、和其它的分家。
`tools/project_env.py --bin-dir` 和 `scripts/env_common.sh` 的 `env_bin_dir()`
都按「找某个已知产物的实际位置」定位,所以**新老两套布局都能兼容**。
更多见 `排错速查.md` §E。