delvewheel
delvewheel copied to clipboard
ANNOUNCEMENT: Access violation in `msvcp140.dll` with GitHub Actions
If you're building a C++ project on GitHub Actions that uses std::mutex
, then you may encounter an access violation when using that project in a delvewheel
-repaired wheel. To fix this, add the argument --add-path C:/Windows/System32
to your delvewheel
invocation.
In the May 2024 release of the Microsoft Visual C++ standard library, a change was made which can cause an access violation if the version of msvcp140.dll
loaded at runtime is older than the version used at build time. Under Microsoft's C++ binary compatibility rules, the version of msvcp140.dll
used at runtime must be the same version as or newer than the version used at build time.
delvewheel
uses the PATH
environment variable to find msvcp140.dll
. Unfortunately, the default PATH
value on the GitHub Actions Windows runner causes C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.422-5\x64\bin\msvcp140.dll
to be found and vendored into the wheel. This version of msvcp140.dll
is from Visual Studio 2017 and may be too old. If your C++ project is built with Visual Studio 2022 17.10 or later, then an access violation will happen if std::mutex
is used and this version of msvcp140.dll
is vendored.
By using the --add-path C:/Windows/System32
argument, you ensure that C:\Windows\System32\msvcp140.dll
, which is new, is earlier in the search path. To help with diagnosing similar errors in the future, delvewheel
1.8.0 now outputs a warning if it detects that a vendored version of a Microsoft Visual C++ DLL is older than the version that was used at build time.