cmake
build_error
ai_generated
partial
CMake 错误:CPack DMG:代码签名失败,错误代码为 1
CMake Error: CPack DMG: Code signing failed with error code 1
ID: cmake/cpack-dmg-signing-failure
75%修复率
85%置信度
1证据数
2023-11-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| cmake 3.27.0 | active | — | — | — |
| cmake 3.28.0 | active | — | — | — |
| cmake 3.29.0 | active | — | — | — |
根因分析
CPack DMG 生成器尝试对磁盘映像进行签名,但签名身份或授权缺失或无效。
English
CPack DMG generator attempted to sign the disk image but the signing identity or entitlements are missing or invalid.
官方文档
https://cmake.org/cmake/help/latest/module/CPackDMG.html解决方案
-
在 CMakeLists.txt 中,在包含 CPack 之前设置 CPACK_DMG_SKIP_CODESIGN 为 TRUE: set(CPACK_DMG_SKIP_CODESIGN TRUE) include(CPack)
-
通过运行以下命令确保存在有效的签名身份: security find-identity -v -p basic 然后将 CPACK_DMG_SIGNING_IDENTITY 设置为匹配的身份字符串: set(CPACK_DMG_SIGNING_IDENTITY "Developer ID Application: Your Name (TEAMID)")
无效尝试
常见但无效的做法:
-
Reinstall Xcode Command Line Tools
80% 失败
Xcode tools are usually not the issue; the problem is a missing or expired signing certificate, not the tools themselves.
-
Set CPACK_DMG_DS_STORE to an empty path
90% 失败
This only changes the DS_Store file location, not the signing process; signing still fails.