From 28413ace874b32af12702a4255b7f4b3031fa6ea Mon Sep 17 00:00:00 2001 From: Baiju Meswani Date: Tue, 11 Jun 2024 10:48:56 -0700 Subject: [PATCH 1/2] Define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR --- cmake/adjust_global_compile_flags.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/adjust_global_compile_flags.cmake b/cmake/adjust_global_compile_flags.cmake index 690b6d4e66154..a0dee8a7877bf 100644 --- a/cmake/adjust_global_compile_flags.cmake +++ b/cmake/adjust_global_compile_flags.cmake @@ -279,6 +279,11 @@ if (MSVC) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gw /GL") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Gw /GL") endif() + + # DLL initialization errors due to old conda msvcp140.dll dll are a result of the new MSVC compiler + # See https://developercommunity.visualstudio.com/t/Access-violation-with-std::mutex::lock-a/10664660#T-N10668856 + # Remove this definition once the conda msvcp140.dll dll is updated. + add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) else() if (NOT APPLE) #XXX: Sometimes the value of CMAKE_SYSTEM_PROCESSOR is set but it's wrong. For example, if you run an armv7 docker From 797f77189f5f1eb5b8d1a19f8ddd6e9c341e031e Mon Sep 17 00:00:00 2001 From: Baiju Meswani Date: Tue, 11 Jun 2024 16:06:34 -0700 Subject: [PATCH 2/2] Address PR comment --- cmake/adjust_global_compile_flags.cmake | 5 ----- tools/ci_build/build.py | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmake/adjust_global_compile_flags.cmake b/cmake/adjust_global_compile_flags.cmake index a0dee8a7877bf..690b6d4e66154 100644 --- a/cmake/adjust_global_compile_flags.cmake +++ b/cmake/adjust_global_compile_flags.cmake @@ -279,11 +279,6 @@ if (MSVC) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gw /GL") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Gw /GL") endif() - - # DLL initialization errors due to old conda msvcp140.dll dll are a result of the new MSVC compiler - # See https://developercommunity.visualstudio.com/t/Access-violation-with-std::mutex::lock-a/10664660#T-N10668856 - # Remove this definition once the conda msvcp140.dll dll is updated. - add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) else() if (NOT APPLE) #XXX: Sometimes the value of CMAKE_SYSTEM_PROCESSOR is set but it's wrong. For example, if you run an armv7 docker diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index c50650ca20c9e..f2f450b93d131 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1548,7 +1548,11 @@ def generate_build_tree( and not args.build_wasm ): if is_windows(): - cflags += ["/guard:cf", "/DWIN32", "/D_WINDOWS"] + # DLL initialization errors due to old conda msvcp140.dll dll are a result of the new MSVC compiler + # See https://developercommunity.visualstudio.com/t/Access-violation-with-std::mutex::lock-a/10664660#T-N10668856 + # Remove this definition (_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) + # once the conda msvcp140.dll dll is updated. + cflags += ["/guard:cf", "/DWIN32", "/D_WINDOWS", "/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR"] if not args.use_gdk: # Target Windows 10 cflags += [