From fe0bd362827f13a7dd1edc7b743ee718b1bb230e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 3 Oct 2023 16:45:48 -0700 Subject: [PATCH 1/3] Disable static + thread-safe on Windows w/ CMake (#3622) The thread-safety feature on Windows requires a hook in DllMain() and thus is only available when HDF5 is built as a shared library. This was previously a warning, but has now been elevated to a fatal error that cannot be overridden with ALLOW_UNSUPPORTED. Fixes GitHub #3613 --- CMakeLists.txt | 5 +++-- release_docs/RELEASE.txt | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebd45c85c2d..da12dd3c94d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -863,8 +863,9 @@ option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) if (HDF5_ENABLE_THREADSAFE) # check for unsupported options if (WIN32) - message (VERBOSE " **** thread-safety option not supported with static library **** ") - message (VERBOSE " **** thread-safety option will not be used building static library **** ") + if (BUILD_STATIC_LIBS) + message (FATAL_ERROR " **** thread-safety option not supported with static library **** ") + endif () endif () if (HDF5_BUILD_FORTRAN) if (NOT ALLOW_UNSUPPORTED) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a0a5dae04d6..57e81893282 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,7 +47,16 @@ New Features Configuration: ------------- - - + - Thread-safety + static library disabled on Windows w/ CMake + + The thread-safety feature requires hooks in DllMain(), which is only + present in the shared library. + + We previously just warned about this, but now any CMake configuration + that tries to build thread-safety and the static library will fail. + This cannot be overridden with ALLOW_UNSUPPORTED. + + Fixes GitHub issue #3613 Library: @@ -62,9 +71,6 @@ New Features Fortran Library: ---------------- - - - - - Removed "-commons" linking option on Darwin, as COMMON and EQUIVALENCE are no longer used in the Fortran source. From e6d2dae4bb9aabcb78b51b6716117b0f4e9c51f1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 3 Oct 2023 19:21:08 -0700 Subject: [PATCH 2/3] Disable CMake static + threadsafe in CI --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40935516deb..23d1f8ff1f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -558,6 +558,7 @@ jobs: if: (matrix.generator != 'autogen') && ! (matrix.thread_safety.enabled) + # NOTE: Windows does not support static + thread-safe - name: CMake Configure (Thread-Safe) run: | mkdir "${{ runner.workspace }}/build" @@ -566,7 +567,7 @@ jobs: ${{ matrix.generator }} \ -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} \ -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ - -DBUILD_SHARED_LIBS=ON \ + -DBUILD_SHARED_LIBS=OFF \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_THREADSAFE:BOOL=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} \ From 6b06a26070bd79603565a2e45d2d13df7e0e5949 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 4 Oct 2023 08:38:37 -0700 Subject: [PATCH 3/3] Disable STATIC builds in TS CI... Fixes a mistake where SHARED builds were disabled in CMake --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23d1f8ff1f3..9944784b4de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -567,7 +567,8 @@ jobs: ${{ matrix.generator }} \ -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} \ -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ - -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=OFF \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_THREADSAFE:BOOL=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} \