Skip to content

Conversation

@zhangboyang
Copy link

Description

Previously, if download failure occurred or interrupted by Ctrl-C, the broken file is not removed. This is true for the first case because "message(FATAL_ERROR ..." stops cmake and "file(REMOVE ..." is never reached. After that, if cmake is run second time, SHA256 verification is skipped and the broken file will be used.

This patch fixes this by always checking SHA256 of the downloaded file, using a if clause. Although "file(DOWNLOAD ... EXPECTED_HASH ..." already provides same functionality, using it makes status printing harder.

Error checking of download status is also improved. The if clause now checks equality, according to cmake's documentation.

The redundant "file(REMOVE ..." is also removed.

Motivation and Context

Before applying this patch: first run, download failure

omited...
-- Setting up Pre-Built obs-deps (x64)
-- Downloading https://github.com/obsproject/obs-deps/releases/download/2025-08-23/windows-deps-2025-08-23-x64.zip
-- Downloading https://github.com/obsproject/obs-deps/releases/download/2025-08-23/windows-deps-2025-08-23-x64.zip - done
-- Setting up Pre-Built obs-deps (x64) - done
-- Setting up Pre-Built Qt6 (x64)
-- Downloading https://github.com/obsproject/obs-deps/releases/download/2025-08-23/windows-deps-qt6-2025-08-23-x64.zip
-- Downloading https://github.com/obsproject/obs-deps/releases/download/2025-08-23/windows-deps-qt6-2025-08-23-x64.zip - done
-- Setting up Pre-Built Qt6 (x64) - done
-- Setting up Chromium Embedded Framework (x64)
-- Downloading https://cdn-fastly.obsproject.com/downloads/cef_binary_6533_windows_x64_v2.zip
CMake Error at cmake/common/buildspec_common.cmake:131 (file):
  file DOWNLOAD cannot compute hash on failed download

    from url: "https://cdn-fastly.obsproject.com/downloads/cef_binary_6533_windows_x64_v2.zip"
    status: [92;"Stream error in the HTTP/2 framing layer"]
Call Stack (most recent call first):
  cmake/windows/buildspec.cmake:103 (_check_dependencies)
  cmake/windows/buildspec.cmake:110 (_check_dependencies_windows)
  cmake/windows/defaults.cmake:24 (include)
  CMakeLists.txt:15 (include)


-- Downloading https://cdn-fastly.obsproject.com/downloads/cef_binary_6533_windows_x64_v2.zip - Failure
CMake Error at cmake/common/buildspec_common.cmake:137 (message):
  Unable to download
  https://cdn-fastly.obsproject.com/downloads/cef_binary_6533_windows_x64_v2.zip,
  failed with error: "Stream error in the HTTP/2 framing layer"
Call Stack (most recent call first):
  cmake/windows/buildspec.cmake:103 (_check_dependencies)
  cmake/windows/buildspec.cmake:110 (_check_dependencies_windows)
  cmake/windows/defaults.cmake:24 (include)
  CMakeLists.txt:15 (include)


-- Configuring incomplete, errors occurred!

Second run, broken downloaded file is used and boom

omited...
-- Setting up Pre-Built obs-deps (x64)
-- Setting up Pre-Built obs-deps (x64) - done
-- Setting up Pre-Built Qt6 (x64)
-- Setting up Pre-Built Qt6 (x64) - done
-- Setting up Chromium Embedded Framework (x64)
cmake -E tar: error: ZIP decompression failed (-5)
-- Setting up Chromium Embedded Framework (x64) - done
-- Found SIMDe: C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/include (found version "0.8.2")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Found FFmpeg: C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/bin/avformat-61.dll;C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/bin/avutil-59.dll;C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/bin/swscale-8.dll;C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/bin/swresample-5.dll;C:/U
sers/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/bin/avcodec-61.dll (found suitable version "7.1", minimum required is "6.1") found components: avformat avutil swscale swresample avcodec
-- Found ZLIB: C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/lib/zlib.lib (found version "1.3.1")
-- Found Uthash: C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/include (found version "2.3.0")
-- Found jansson: C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/lib/jansson.lib (found version "2.14.1")
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Found OpenGL: opengl32
-- aja: Using new libajantv2 library
CMake Warning (dev) at cmake/finders/FindLibAJANTV2.cmake:100 (message):
  Failed to find LibAJANTV2 version.
Call Stack (most recent call first):
  plugins/aja/CMakeLists.txt:10 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found LibAJANTV2: optimized;C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/lib/ajantv2.lib;debug;C:/Users/zby/Desktop/obs-studio/.deps/obs-deps-2025-08-23-x64/lib/ajantv2d.lib (found version "0.0.0")
CMake Warning (dev) at cmake/finders/FindCEF.cmake:85 (message):
  Failed to find Chromium Embedded Framework version.
Call Stack (most recent call first):
  plugins/obs-browser/CMakeLists.txt:12 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake:290 (message):
  Could NOT find CEF: Found unsuitable version "0.0.0", but required is at
  least "95" (found CEF_IMPLIB_RELEASE-NOTFOUND)

      Reason given by package: Ensure that location of pre-compiled Chromium Embedded Framework is set as CEF_ROOT_DIR.

Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake:652 (_FPHSA_FAILURE_MESSAGE)
  cmake/finders/FindCEF.cmake:182 (find_package_handle_standard_args)
  plugins/obs-browser/CMakeLists.txt:12 (find_package)


-- Configuring incomplete, errors occurred!

How Has This Been Tested?

Win10 x64, Visual C++ 2022 Community, Git-2.52.0, CMake 4.2.3
Manually run cmake few times, it now correctly redownload broken dependency files.

Types of changes

Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Previously, if download failure occurred or interrupted by Ctrl-C, the
broken file is not removed. This is true for the first case because
"message(FATAL_ERROR ..." stops cmake and "file(REMOVE ..." is never
reached. After that, if cmake is run second time, SHA256 verification is
skipped and the broken file will be used.

This patch fixes this by always checking SHA256 of the downloaded file,
using a if clause. Although "file(DOWNLOAD ... EXPECTED_HASH ..."
already provides same functionality, using it makes status printing
harder.

Error checking of download status is also improved. The if clause now
checks equality, according to cmake's documentation.

The redundant "file(REMOVE ..." is also removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant