-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling chess engine stockfish with MSYS2 using mingw-w64-x86_64-libwinpthread-git-7.0.0.5447 (and later versions) #5610
Comments
There were locking changes in winpthreads recently. |
See the commit here. There have been reports about deadlocks here and here, which don't deadlock on Linux. With the most recent two commits these deadlocks are eliminated. Perhaps you may have a look at this patch. You may re-build winpthreads with this patch applied and see whether it still causes deadlocks. (This patch might no longer apply to master. Please edit by hand.) |
@mati865 : where? Looking at https://sourceforge.net/p/mingw-w64/mingw-w64/ci/a6f0bf18209b9a2d4e51dd121df03d9dcfbc9838/log/?path=/mingw-w64-libraries/winpthreads the last changes were made 2019-04-26 and the version that the OP reports as working (7.0.0.5447.a2d94c81-1) contained those changes. |
Hello, => The issue (my created binary produces hangs) is still here, it's 100% reproducible. By using an alternative mingw (additional I always keep my msys2 up to date, so I don't know exactly when it broke, I did not have the problem with older msys2 gcc versions. So my question is: What is the best way, to downgrade for example to |
@CoffeeOne : download the gcc package from repo.msys2.org (you will need the gcc-libs package for the same version too) and then
You need to list the gcc and the gcc-libs packages on the same command above, because their versions must match and pacman will complain if you try to install them separately. |
@oscarfv Thx!
That works now 100% for me, no more hangs in my self compiled stockfish.exe |
5325 denotes the roughly 155th commit preceding HEAD, so I presume it is around 52f2ce12 (with the subject ' Ensure wait timeouts are respected') that the offending commit is located. |
Sorry for for just wild guessing, but isn't this main change |
It has fixed another deadlock so it will not reverted. If the other patch above fixes this for you, I may check it in as a different commit. |
Can you give me a hint how to build (and deploy to my MSYS2) a patched libwinpthread? |
@CoffeeOne First you should build vanilla |
I was successful in building the library. |
The last commit Would you please provide some stack backtraces so we are able to tell in which function the deadlock occurs ? |
I managed to attach gdb (when the chess engine already was hanging) to the stockfish.exe process:
How can I get the function names inisde |
I am sorry, I "stripped" the stockfish.exe, that makes no sense for debugging: I tried with a newly compiled exe (no strip):
|
and a second hang, looks similar:
|
@CoffeeOne : on the PKGBUILD of winpthreads change the line:
to
and then rebuild the package. |
Thx, I rebuild the winpthread (no changes in cond.c!)
|
It seems that at least a call to wakeup functions was missed. Could you provide a self-contained test program that consists of only one file please? |
@CoffeeOne I suggest to rename the issue in something more meaningful like this "winpthreads bug with stockfish". Great catch! |
@lhmouse |
@CoffeeOne the latest msys2 update seems to have solved this bug. Here are my tests official-stockfish/Stockfish#2305 (comment) , please confirm with some tests on your pc. |
@ppigazzini |
Reported by @f11894 #9 (comment) Issue at MSYS2: msys2/MINGW-packages#5610
After compiling the open source engine stockfish, I have problems to run the builtin benchmark of it ("bench"). So compiling is still fine, but I have hangs. It seems to be related with threading, but unfortunately I am not able to debug this issue.
official-stockfish/Stockfish#222
My SYS2 is fully updated, to compile stockfish I basically need only make and mingw-w64-x86_64-gcc. It has defintely something to do with the build tool-chain, because replacing the mingw64 folder with a mingw from Sourceforge (latest is only gcc 8.1.0 there) made the problem go away.
I manually downgraded
libwinpthread-1.dll
by downloadinghttp://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-7.0.0.5447.a2d94c81-1-any.pkg.tar.xz
and putting (overwriting the existing) to
C:\msys64\mingw64\bin
I am still testing, but the problem seems to be gone now.
Can you check if something is wrong with the latest libwinpthread?
The text was updated successfully, but these errors were encountered: