cmake
network_error
ai_generated
true
CMake 错误:FetchContent:完整性检查失败 <https://example.com/repo/archive/v1.0.tar.gz> 期望哈希:abc123def456 实际哈希:789012ghi345
CMake Error: FetchContent: Integrity check failed for <https://example.com/repo/archive/v1.0.tar.gz> Expected hash: abc123def456 Actual hash: 789012ghi345
ID: cmake/fetchcontent-integrity-failure
80%修复率
85%置信度
1证据数
2024-05-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| cmake 3.14 | active | — | — | — |
| cmake 3.20 | active | — | — | — |
| cmake 3.28 | active | — | — | — |
根因分析
下载的存档哈希与 FetchContent_Declare 中指定的期望哈希不匹配,表明下载损坏、中间人攻击或期望哈希已过时。
English
The downloaded archive's hash does not match the expected hash specified in FetchContent_Declare, indicating a corrupted download, a man-in-the-middle attack, or an outdated expected hash.
官方文档
https://cmake.org/cmake/help/latest/module/FetchContent.html解决方案
-
删除缓存的下载:rm -rf build/_deps/<name>-src 然后重新配置以强制重新下载。
-
将 FetchContent_Declare 中的期望哈希更新为官方来源的正确哈希,然后清除缓存。
无效尝试
常见但无效的做法:
-
60% 失败
FetchContent caches the corrupted archive; need to delete the _deps directory first.
-
80% 失败
May accept a malicious or corrupted file; always verify the hash from a trusted source.