cmake
install_error
ai_generated
true
CMake 错误:CPack 生成器:此平台不支持 DEB。
CMake Error: CPack generator: DEB is not supported on this platform.
ID: cmake/cpack-generator-not-found
88%修复率
85%置信度
1证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| CMake 3.16 | active | — | — | — |
| CMake 3.20 | active | — | — | — |
| CMake 3.28 | active | — | — | — |
根因分析
指定的 CPack 生成器(例如 DEB)在当前操作系统上不可用(例如 Windows 或没有 dpkg 的 macOS)。
English
CPack generator specified (e.g., DEB) is not available on the current operating system (e.g., Windows or macOS without dpkg).
官方文档
https://cmake.org/cmake/help/latest/module/CPack.html解决方案
-
使用平台条件生成器选择:if(WIN32) set(CPACK_GENERATOR "NSIS") else() set(CPACK_GENERATOR "DEB") endif()。这确保只使用支持的生成器。
-
对于跨平台构建,使用通用生成器如 TGZ 或 STGZ,它们在所有平台上工作:在 CMakeLists.txt 中设置 set(CPACK_GENERATOR "TGZ")。
-
从命令行运行 cpack -G TGZ 覆盖生成器,而不是修改 CMakeLists.txt。
无效尝试
常见但无效的做法:
-
90% 失败
dpkg requires a Debian-based system to function correctly; cross-platform DEB generation is not supported by CPack without extensive toolchain setup.
-
100% 失败
The error is about platform support, not configuration duplication; the generator must be available on the host system.