file(DOWNLOAD) fails on Windows with [35;"SSL connect error"] but still creates an empty output file - failure is caused by USE_NGHTTP2=ON
Hello!
I'm struggling to understand why I can no longer build grpc via cmake on Windows 11 (and Windows Server 2022). This is where it fails: https://github.com/grpc/grpc/blob/v1.50.0/CMakeLists.txt#L370
Basically, it fails to download a package from Google Storage only on Windows.
Tested with CMake 3.25.0-rc2
and 3.23.22060601-MSVC_2
(bundled with VC++).
Here's a small script to reproduce the issue:
cmake_minimum_required(VERSION 3.22)
project(TestTls)
set(OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/output.tar.gz)
# download succeeds from github.com
file(REMOVE ${OUTPUT_FILE})
file(DOWNLOAD
https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz
${OUTPUT_FILE}
EXPECTED_HASH SHA256=b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0
SHOW_PROGRESS
TLS_VERIFY ON
)
message("-- OK")
# download fails from storage.googleapis.com
file(REMOVE ${OUTPUT_FILE})
file(DOWNLOAD
https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz
${OUTPUT_FILE}
EXPECTED_HASH SHA256=b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0
SHOW_PROGRESS
TLS_VERIFY ON
)
output:
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.20348.
-- The C compiler identification is MSVC 19.33.31630.0
-- The CXX compiler identification is MSVC 19.33.31630.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [download 8% complete]
-- [download 25% complete]
-- [download 60% complete]
-- [download 100% complete]
-- OK
CMake Error at CMakeLists.txt:20 (file):
file DOWNLOAD HASH mismatch
for file: [C:/Users/Administrator/AppData/Local/Temp/test/build/output.tar.gz]
expected hash: [b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0]
actual hash: [e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855]
status: [35;"SSL connect error"]
-- Configuring incomplete, errors occurred!
See also "C:/Users/Administrator/AppData/Local/Temp/test/build/CMakeFiles/CMakeOutput.log".
The main error is somehow misleading because an empty file is created, which is why the hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
is generated.
So I think there's also a room of improvement regarding the handling of this error [35;"SSL connect error"]
: no output file should be generated rather than an empty one.
Regarding the SSL error itself, I have no clue why it fails... knowing that it succeeded a few weeks ago
Any idea?
Thanks!