Skip to content

Commit

Permalink
Define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR (#21005)
Browse files Browse the repository at this point in the history
microsoft/STL#3824 introduces constexpr mutex.
An older version of msvcp140.dll will lead to ```A dynamic link library
(DLL) initialization routine failed```.

This error can be encountered if using conda Python since conda packages
msvc dlls and these are older right now.

This PR disables the constexpr mutex so that ort package can work with
older msvc dlls.

Thanks @snnn for the discovery.
  • Loading branch information
baijumeswani authored Jun 12, 2024
1 parent 9be3034 commit 94aa21c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down

0 comments on commit 94aa21c

Please sign in to comment.