From 8a62afa5dd0fd8e9fa4d30f8960f38d882728212 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Aug 2024 15:34:39 -0400 Subject: [PATCH] BLD: Include MSVCP140 runtime statically This should prevent conflicts with other wheels that use the runtime at a different version. --- .github/workflows/cibuildwheel.yml | 10 +++++++++- doc/api/next_api_changes/development/28687-ES.rst | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 doc/api/next_api_changes/development/28687-ES.rst diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 4e8ea0ab5bf6..9de63b14c4fd 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -100,7 +100,15 @@ jobs: CIBW_AFTER_BUILD: >- twine check {wheel} && python {package}/ci/check_wheel_licenses.py {wheel} - CIBW_CONFIG_SETTINGS: setup-args="--vsenv" + # On Windows, we explicitly request MSVC compilers (as GitHub Action runners have + # MinGW on PATH that would be picked otherwise), switch to a static build for + # runtimes, but use dynamic linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, + # and the UCRT. This avoids requiring specific versions of `MSVCP140.dll`, while + # keeping shared state with the rest of the Python process/extensions. + CIBW_CONFIG_SETTINGS_WINDOWS: >- + setup-args="--vsenv" + setup-args="-Db_vscrt=mt" + setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']" CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_SKIP: "*-musllinux_aarch64" CIBW_TEST_COMMAND: >- diff --git a/doc/api/next_api_changes/development/28687-ES.rst b/doc/api/next_api_changes/development/28687-ES.rst new file mode 100644 index 000000000000..339dafdd05d0 --- /dev/null +++ b/doc/api/next_api_changes/development/28687-ES.rst @@ -0,0 +1,10 @@ +Windows wheel runtime bundling made static +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In 3.7.0, the MSVC runtime DLL was bundled in wheels to enable importing Matplotlib on +systems that do not have it installed. However, this could cause inconsistencies with +other wheels that did the same, and trigger random crashes depending on import order. See +`this issue `_ for further +details. + +Since 3.9.2, wheels now bundle the MSVC runtime DLL statically to avoid such issues.