cmake下载哈希不匹配

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cmake下载哈希不匹配相关的知识,希望对你有一定的参考价值。

我需要从github构建项目:

https://github.com/andre-schulz/mve

它在Cmake文件中有以下步骤:

set(ZLIB_FILENAME "zlib-1.2.11.tar.xz")
blablabla
set(ZLIB_URL "https://download.sourceforge.net/libpng/${ZLIB_FILENAME}")
blablabla
ExternalProject_Add(zlib
    PREFIX build/zlib
    URL ${ZLIB_URL}
    URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
    INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}
    CMAKE_ARGS
        -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
        -DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
        -DSKIP_INSTALL_FILES:BOOL=ON)

问题是即使连接良好也无法下载文件(我在浏览器中快速下载文件,我没有代理)。所以我在建造期间得到了这个垃圾:

3>    does not match expected value
3>      expected: 'c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764'
3>        actual: '7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf'
3>  -- Hash mismatch, removing...
3>  -- Retry after 5 seconds (attempt #2) ...
2>  -- Using src='https://download.sourceforge.net/libpng/zlib-1.2.11.tar.xz'
2>  -- Retry after 5 seconds (attempt #3) ...
3>  -- Using src='https://downloads.sourceforge.net/project/glew/glew/2.0.0/glew-2.0.0.tgz'
2>  -- Using src='https://download.sourceforge.net/libpng/zlib-1.2.11.tar.xz'
2>  -- Retry after 15 seconds (attempt #4) ...
3>  -- [download 100% complete]
3>  -- verifying file...
3>         file='C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz'
3>  -- SHA256 hash of
3>      C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz
3>    does not match expected value
3>      expected: 'c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764'
3>        actual: '7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf'
3>  -- Hash mismatch, removing...
3>  -- Retry after 5 seconds (attempt #3) ...
3>  -- Using src='https://downloads.sourceforge.net/project/glew/glew/2.0.0/glew-2.0.0.tgz'
3>  -- [download 100% complete]
3>  -- verifying file...
3>         file='C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz'
3>  -- SHA256 hash of
3>      C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz
3>    does not match expected value
3>      expected: 'c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764'
3>        actual: '7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf'
3>  -- Hash mismatch, removing...
3>  -- Retry after 15 seconds (attempt #4) ...
2>  -- Using src='https://download.sourceforge.net/libpng/zlib-1.2.11.tar.xz'
3>  -- Using src='https://downloads.sourceforge.net/project/glew/glew/2.0.0/glew-2.0.0.tgz'
2>  -- Retry after 60 seconds (attempt #5) ...
3>  -- [download 100% complete]
3>  -- verifying file...
3>         file='C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz'
3>  -- SHA256 hash of
3>      C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz
3>    does not match expected value
3>      expected: 'c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764'
3>        actual: '7a07d3f7cca5c0b38ca811984ef8da536da32932d68c1a6cce33ec2462b930bf'
3>  -- Hash mismatch, removing...

可能是什么原因以及如何手动下载文件?是否可以避免重新下载文件?

答案

要手动下载文件,您可以下载文件一次并将其放在CMake预期的位置。这里似乎C:/Users/steve/Dropbox/Projects/kinnekt/git/mve-win/mve/3rdparty/build/glew/src/glew-2.0.0.tgz

只要哈希匹配,CMake就不会重新尝试下载。

以上是关于cmake下载哈希不匹配的主要内容,如果未能解决你的问题,请参考以下文章

RStan 卡在“哈希不匹配所以重新编译”确保 Stan 代码以空行结尾

哈希链接与导航菜单不匹配

无效的密钥哈希。密钥哈希与任何存储的密钥哈希不匹配 facebook android

OSX + homebrew + CMake + libpng 版本不匹配问题

firebase 的短信代码不匹配

CMake:如何避免 HDF5 系统和 conda 安装中的不匹配?