https://bugs.winehq.org/show_bug.cgi?id=52821
Bug ID: 52821 Summary: Missing support of C++20 Semaphores in built-in Wine C++ runtime Product: Wine Version: 7.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcp Assignee: wine-bugs@winehq.org Reporter: kle@bluewin.ch Distribution: ---
Hi all
Right at the beginning it should be noted that the following error may have been already described.
There seems to exist currently no support of C++20 Semaphores in Wines built-in C++ library. I noticed this limitation with two applications. The following "msvcp140_atomic_wait.dll" related error message is shown when this issue occurs. Both apps crash right after.
CXBX-R Xbox emulator (starting with build 374ba5e):
wine: Call from 7B011586 to unimplemented function msvcp140_atomic_wait.dll.__std_atomic_wait_direct, aborting wine: Call from 7B011586 to unimplemented function msvcp140_atomic_wait.dll.__std_atomic_notify_one_direct, aborting
PCSX-Redux PSX emulator (all newer builds since 4317):
wine: Call from 0000000000272B9E to unimplemented function msvcp140_atomic_wait.dll.__std_atomic_wait_direct, aborting wine: Unimplemented function msvcp140_atomic_wait.dll.__std_atomic_wait_direct called at address 0000000000272B9E (thread 010c), starting debugger... wine: Call from 0000000000272B9E to unimplemented function msvcp140_atomic_wait.dll.__std_atomic_notify_one_direct, aborting
Both applications worked before the "std::binary_semaphore" C++20 type was introduced.
It is confirmed for Wine 7.0 that it can handle this situation when vcrun2019 (native MS Visual C++ 2019) is installed via winetricks. But for whatever reason this stopped to work in later Wine 7.x devel versions.
A further workaround was to put a native "msvcp140_atomic_wait.dll" into the program folder. I can confirm that this helped at least for a while in conjunction with the PCSX-Redux emulator. But also here this tweak stopped to work in later Wine 7.x devel versions.
More information can be found at the CXBX-R GitHub issue page: https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/2347
https://bugs.winehq.org/show_bug.cgi?id=52821
--- Comment #1 from C. Leu kle@bluewin.ch --- I found a manual workaround to get this working. :-)
A short HowTo:
- rename Wines msvcp140_atomic_wait.dll in System32 and SysWOW64 to msvcp140_atomic_waitWINE.dll (or else)
- copy the original MS msvcp140_atomic_wait.dll into the corresponding folder, the 64bit into System32 and the 32bit into SysWOW64
- start up winecfg from the CLI and select "Libraries", add here a new one called msvcp140_atomic_wait (without the dll extension)
There should be now a new entry "msvcp140_atomic_wait (Native, Builtin)". Exit winecfg and start up CXBX-R build 374ba5e. It should work again. I have tested this also with PCSX-Redux nightly 8457.
Note, I grabbed the latest msvcp140_atomic_wait.dll file version from my last Windows 7 computer where I have installed the current MSVC runtime library from here. As of April 2022 it gave me file version 14.31.31103.0.
https://bugs.winehq.org/show_bug.cgi?id=52821
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| |https://github.com/Cxbx-Rel | |oaded/Cxbx-Reloaded/
--- Comment #2 from Austin English austinenglish@gmail.com --- Looks like msvcp140_atomic_wait.dll was added in wine-7.1.
I've made a winetricks branch that I think will fix this, could you try: https://github.com/austin987/winetricks/commit/9c97d44b9b68a1b09e244e46f9ae0...
I tried cxbx-reloaded, but wasn't able to reproduce this (I don't have any xbox images to test with).
https://bugs.winehq.org/show_bug.cgi?id=52821
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=52821
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Missing support of C++20 |Cxbx Reloaded needs |Semaphores in built-in Wine |unimplemented function |C++ runtime |msvcp140_atomic_wait.dll.__ | |std_atomic_wait_direct
https://bugs.winehq.org/show_bug.cgi?id=52821
--- Comment #3 from C. Leu kle@bluewin.ch --- Thanks Austin English for this informative answer.
So this is the reason why vcrun2019 didn't work in later Wine 7.x versions. Great, you solved the mystery! ;-)
I think your modification in winetricks will for sure work. I would test that if I could but I am currently not so familiar in building stuff like this at my own.
And regarding vcrun2019 with the CXBX-R emulator. I noticed in later Wine releases (starting from 6.7) some quite weird symptoms like crashes when native MS Visual C++ 2019 was present. So I prefer to NOT install it when ever possible. Later Wine releases didn't needed it anymore, CXBX-R was running better with the built-in C++ library. (Although it is officially noted that vcrun2019 is still needed.)
Well yes this has changed now again because of the C++20 Semaphores which requires the msvcp140_atomic_wait.dll.
I now ask me if a sole "C++20 Semaphores" argument would make sense in winetricks. So this would then install only msvcp140_atomic_wait.dll and nothing else.
https://bugs.winehq.org/show_bug.cgi?id=52821
--- Comment #4 from C. Leu kle@bluewin.ch --- Awesome, - I found out an even simpler manual workaround! :-)
A new short HowTo:
- simply copy the original msvcp140_atomic_wait.dll into the affected program folder.
So in my case, the 32bit msvcp140_atomic_wait.dll goes into the CXBX folder because it is effectively a 32bit application. The 64bit msvcp140_atomic_wait.dll comes into the PCSX-Redux folder because PCSX-Redux is a 64bit application.
- start up winecfg from the CLI and select "Libraries", add here a new one called msvcp140_atomic_wait (without the dll extension)
As in the previous HowTo, there should be now a new entry "msvcp140_atomic_wait (Native, Builtin)".
You should be able to start the affected program normally. I can confirm that this works again perfectly well for me. This is also the better solution for the case that the wine-prefix gets updated. And in contrast to the vcrun2019 winetricks argument this solution is easy reversible (especially for simply "knitted" end-users) and doesn't install the whole native MS Visual C++ 2019 "ballast" when it is effectively not needed. ;-)
https://bugs.winehq.org/show_bug.cgi?id=52821
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- These functions have been implemented recently:
https://source.winehq.org/git/wine.git/commit/32a369d6c2e7b526c2b3e4bf393049... https://source.winehq.org/git/wine.git/commit/4c26471abeb3ddc481717294d373e2... https://source.winehq.org/git/wine.git/commit/87f3b50b2d256726e9a150f3a53798...
Please retest with current wine. I tried cxbx, but it seems to start without these functions as well as with current wine.
https://bugs.winehq.org/show_bug.cgi?id=52821
--- Comment #6 from C. Leu kle@bluewin.ch --- @Nikolay Sivov thanks for the hint! Will test asap. This will land in Wine devel 7.8, right?
And by the way, you need a Xbox game (aka "xbe" file) to provoke the msvcp140_atomic_wait.dll situation. So the error only happens right after a game is loaded.
Weather, I'll report back what the situation is.
https://bugs.winehq.org/show_bug.cgi?id=52821
C. Leu kle@bluewin.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #7 from C. Leu kle@bluewin.ch --- Great news, this problem is resolved in Wine 7.8 devel!
So I can confirm that the CXBX-Reloaded build 374ba5e which uses C++20 Semaphores is working fine with the built-in "msvcp140_atomic_wait.dll.__std_atomic_wait_direct" function.
Therefore the native "msvcp140_atomic_wait.dll" file is no longer needed. :-)
Will close this report here. Many thanks for implementing this function in Wine and also many thanks to Austin English to add support for the msvcp140_atomic_wait.dll file in winetricks. +1
https://bugs.winehq.org/show_bug.cgi?id=52821
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |87f3b50b2d256726e9a150f3a53 | |798de8791b2a7
https://bugs.winehq.org/show_bug.cgi?id=52821
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.9.