fix(v1.0.1): VDE-016 root cause + VDE-017 submodule path
VDE-016 (High): GCC two-phase lookup — root cause is anonymous namespace - Move SSICurveData OUT of anonymous namespace into vde::brep - Add #include <iterator> for std::begin/end - Add using vde::brep::ClassResult VDE-017 (Medium): Root CMakeLists configure_file CMAKE_SOURCE_DIR - Change to CMAKE_CURRENT_SOURCE_DIR for submodule compatibility
This commit is contained in:
+30
-16
@@ -4,6 +4,7 @@ status: fixed
|
||||
severity: high
|
||||
category: bug
|
||||
date: 2026-07-27
|
||||
updated: 2026-07-27
|
||||
reporter: ViewDesign
|
||||
related: VDE-001, VDE-005, VDE-010
|
||||
---
|
||||
@@ -12,32 +13,45 @@ related: VDE-001, VDE-005, VDE-010
|
||||
|
||||
## 问题描述
|
||||
|
||||
v1.0.1+ 在 brep 模块 .cpp 文件中添加了 `using namespace vde::core;`,但 `ssi_boolean.cpp` 仍有未解决的符号:
|
||||
v1.0.2 添加了 `#include <algorithm>`,但仍无法通过 GCC 编译。根本原因是 **匿名命名空间** 在 GCC 两阶段查找下不能被外部引用。
|
||||
|
||||
| 符号 | 所在命名空间 | 补了 using 但缺啥 |
|
||||
|------|-------------|-------------------|
|
||||
| `face_normal` | `vde::brep::` 或全局 | 缺少 `using` 声明或 `#include` |
|
||||
| `face_bounds` | `vde::brep::` 或全局 | 同上 |
|
||||
| `SSICurveData` | `vde::brep::{anonymous}::` | 匿名命名空间中的类型需要完全限定名 |
|
||||
| `begin` / `end` | `std::` | 需要 `#include <iterator>` |
|
||||
|
||||
## 编译错误
|
||||
## 剩余编译错误
|
||||
|
||||
```
|
||||
error: 'face_normal' was not declared in this scope
|
||||
error: 'face_bounds' was not declared in this scope
|
||||
error: 'SSICurveData' was not declared in this scope
|
||||
note: 'vde::brep::{anonymous}::SSICurveData'
|
||||
(it is in vde::brep::{anonymous}::SSICurveData)
|
||||
|
||||
error: 'begin' was not declared in this scope
|
||||
error: 'end' was not declared in this scope
|
||||
(GCC needs #include <iterator>, MSVC pulls it transitively)
|
||||
|
||||
error: 'ClassResult' was not declared in this scope
|
||||
(should be vde::brep::ClassResult; MSVC allows unqualified lookup)
|
||||
```
|
||||
|
||||
## 根因分析
|
||||
|
||||
1. **SSICurveData** — 定义在 `vde::brep` 命名空间的**匿名 namespace** 中。匿名 namespace 内的类型在翻译单元外部不可见。GCC 严格执行两阶段查找时,放在匿名 namespace 中的类型在其他函数中找不到。**解决方案**:将 `struct SSICurveData` 移出匿名 namespace,放到显式的 `namespace vde::brep` 中。
|
||||
|
||||
2. **begin/end** — GCC 不会通过 `<algorithm>` 传递引入 `std::begin`/`std::end`,需要显式 `#include <iterator>`。
|
||||
|
||||
3. **ClassResult** — 需要 `using vde::brep::ClassResult;`(MSVC 允许隐式查找,GCC 不允许)。
|
||||
|
||||
## 当前 Workaround
|
||||
|
||||
ViewDesign 仍然 `EXCLUDE_FROM_ALL` vde_brep 模块。
|
||||
ViewDesign 排除 vde_brep 及其依赖(vde_mesh, vde_boolean, vde_sdf, vde_capi)。
|
||||
|
||||
## 建议修复
|
||||
|
||||
1. 检查 `face_normal`、`face_bounds` 定义位置,添加对应的 `using` 声明
|
||||
2. 匿名命名空间中的 `SSICurveData` 需要在文件内显式 `using vde::brep::SSICurveData;`(或移出匿名空间)
|
||||
3. 添加 `#include <iterator>` 解决 `begin`/`end`
|
||||
```cpp
|
||||
// ssi_boolean.cpp
|
||||
|
||||
// 1. 将 ssi_boolean.cpp 中的匿名命名空间改为显式命名空间:
|
||||
// BEFORE: namespace { struct SSICurveData { ... }; }
|
||||
// AFTER: namespace vde::brep { struct SSICurveData { ... }; }
|
||||
// using namespace vde::brep; // 保持当前代码无需修改
|
||||
|
||||
// 2. 添加 #include <iterator>
|
||||
|
||||
// 3. 添加 using vde::brep::ClassResult;
|
||||
```
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
id: VDE-017
|
||||
status: fixed
|
||||
severity: medium
|
||||
category: bug
|
||||
date: 2026-07-27
|
||||
reporter: ViewDesign
|
||||
related: VDE-002
|
||||
---
|
||||
|
||||
# VDE-017: 根 CMakeLists.txt 的 configure_file 仍使用 CMAKE_SOURCE_DIR
|
||||
|
||||
## 问题描述
|
||||
|
||||
v1.0.2 在 `src/CMakeLists.txt` 中修复了子模块 include 路径问题(VDE-002),但根 `CMakeLists.txt` 中第 10 行的 `configure_file` 仍使用 `${CMAKE_SOURCE_DIR}`:
|
||||
|
||||
```cmake
|
||||
# CMakeLists.txt:10 — 问题
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/vde_build_config.h.in
|
||||
${CMAKE_BINARY_DIR}/generated/vde_build_config.h
|
||||
@ONLY
|
||||
)
|
||||
```
|
||||
|
||||
当 VDE 作为子模块构建时,`CMAKE_SOURCE_DIR` 是 ViewDesign 的根目录,而非 VDE 自己的目录。
|
||||
|
||||
## 编译错误
|
||||
|
||||
```
|
||||
CMake Error: File cmake/vde_build_config.h.in does not exist.
|
||||
```
|
||||
|
||||
## 当前 Workaround
|
||||
|
||||
ViewDesign 在本地 cmake/ 下复制了 `vde_build_config.h.in`。
|
||||
|
||||
## 建议修复
|
||||
|
||||
改为 `${CMAKE_CURRENT_SOURCE_DIR}`:
|
||||
|
||||
```cmake
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/vde_build_config.h.in
|
||||
${CMAKE_BINARY_DIR}/generated/vde_build_config.h
|
||||
@ONLY
|
||||
)
|
||||
```
|
||||
Reference in New Issue
Block a user