mrdcvlsc / analyse-pgn

A command line application that analyzes chess games in PGN file format
GNU General Public License v3.0
5 stars 2 forks source link

Broken `winProcRun.hpp` Windows OS Pipes (Interprocess Communications) #12

Open mhdshl82 opened 4 months ago

mhdshl82 commented 4 months ago

It seems to be a good program and I would like to use it but after downloading the windows executable and running it using for example the cmd command: apgn first.pgn it gives back the following message Engine : C:\analyse-pgn-1.1/bin/engines/stockfish11_x86.exe Threads : 1 Depth : 11 Color : A Openning Moves to Skip : 4

Analysing first.pgn please wait... CreateProcessA: 2 terminate called after throwing an instance of 'std::runtime_error' what(): Creating Child Process Failed

so the process is interrupted . thank you in advance for helping with this issue.

tissatussa commented 4 months ago

Engine : C:\analyse-pgn-1.1/bin/engines/stockfish11_x86.exe

i know this program, although i was using the Linux version .. i had no problems with it, but maybe i can solve yours by saying the above line contains slash AND blackslash characters, i remember Windows using (only) '\' ?!

mhdshl82 commented 4 months ago

Engine : C:\analyse-pgn-1.1/bin/engines/stockfish11_x86.exe

i know this program, although i was using the Linux version .. i had no problems with it, but maybe i can solve yours by saying the above line contains slash AND blackslash characters, i remember Windows using (only) '\' ?!

thank you for replying i also tried the command with the current stockfish version C:\analyse-pgn-1.1>apgn -engine "C:\analyse-pgn-1.1\stockfish.exe" first.pgn

Engine : C:\analyse-pgn-1.1\stockfish.exe Threads : 1 Depth : 11 Color : A Openning Moves to Skip : 4

Analysing first.pgn please wait... CreateProcessA: 2 terminate called after throwing an instance of 'std::runtime_error' what(): Creating Child Process Failed so, it gives the same message and interrupts the process

tissatussa commented 4 months ago

@mhdshl82 can you paste the contents of that .pgn file ? it may contain errors ..

tissatussa commented 4 months ago

it's best the author tells about that std::runtime_error .. maybe you can run the program while using a debugger, like gdb or lldb (they're for Linux, i don't know modern Windows too much) .. such tool may show details regarding the point the error happens.

mhdshl82 commented 4 months ago

@mhdshl82 can you paste the contents of that .pgn file ? it may contain errors ..

sure, here is it. In fact, it is provided with the source code of the program in the folder pgn_samples

[Event "sample game"] [Site "chesstest.com"] [Date "2012.12.12"] [Round "?"] [White "player1"] [Black "player2"] [Result "1-0"] [TimeControl "180"] [WhiteElo "1342"] [BlackElo "1335"] [Termination "player1 won on time"]

  1. d4 d5 2. Nf3 Nf6 3. c4 c6 4. Bg5 Bf5 5. Nc3 h6 6. Bxf6 exf6 7. e3 Bb4 8. cxd5 Qxd5 9. Nh4 Bxc3+ 10. bxc3 Bg6 11. c4 Qa5+ 12. Qd2 Qxd2+ 13. Kxd2 Nd7 14. f3 O-O-O 15. e4 Nb6 16. Rb1 Rxd4+ 17. Kc3 Rdd8 18. Be2 Rhe8 19. g3 Na4+ 20. Kb4 Nb6
  2. Rhd1 Kc7 22. Ng2 Rxd1 23. Rxd1 Re7 24. Ne3 Nd7 25. a4 Ne5 26. Rd2 b6 27. a5 c5+ 28. Kb5 bxa5 29. Nd5+ Kd6 30. Nxe7+ Kxe7 31. Kxc5 Nd7+ 32. Kb5 a4 33. Kxa4 Nc5+ 34. Kb5 Nb3 35. Rb2 Nd4+ 36. Ka6 Nxe2 37. Rxe2 Kd6 38. Kxa7 Kc5 39. Rc2 Kd4
  3. Kb6 Kd3 41. Rc1 Kd2 42. Ra1 Kd3 43. c5 f5 44. c6 fxe4 45. c7 Bf5 46. fxe4 Kxe4 47. Rf1 Be6 48. Kc6 Ke3 49. Kd6 Ke2 50. Rf4 g5 51. Rf6 Ke3 52. Kc6 Ke4 53. Kb7 Ke5 54. Rxe6+ Kxe6 55. c8=Q+ Kf6 56. Qc6+ Kg7 57. Qc3+ Kg6 58. Qd3+ Kg7 59. Qd4+ f6 60. Qd7+ Kg6 61. Qd3+ Kg7 62. g4 Kf7 63. Qf5 Ke7 64. Kb6 Kf7 65. Kc6 Ke7
  4. Kd5 Kf7 67. Kd6 Kg7 68. Ke6 h5 69. Qxf6+ Kh7 70. Qxg5 1-0
tissatussa commented 4 months ago

seems OK, but such text better be placed in this web editor between backtick characters ( ` ) or three of such when including a multi-line-text like yours ..

mrdcvlsc commented 4 months ago

@mhdshl82 I'm assuming you have tried the command below?

cd 'C:\analyse-pgn-1.1'
apgn pgn_samples\first.pgn

Another question is when you tried the commands you mentioned above (shown below), did you copied/moved the first.pgn file first from the C:\analyse-pgn-1.1\pgn_samples into the parent folder C:\analyse-pgn-1.1?

apgn first.pgn
apgn -engine "C:\analyse-pgn-1.1\stockfish.exe" first.pgn
mhdshl82 commented 4 months ago

@mhdshl82 I'm assuming you have tried the command below?

cd 'C:\analyse-pgn-1.1'
apgn pgn_samples\first.pgn

Another question is when you tried the commands you mentioned above (shown below), did you copied/moved the first.pgn file first from the C:\analyse-pgn-1.1\pgn_samples into the parent folder C:\analyse-pgn-1.1?

apgn first.pgn
apgn -engine "C:\analyse-pgn-1.1\stockfish.exe" first.pgn

Yes, all paths were correct. I tried cd 'C:\analyse-pgn-1.1' apgn pgn_samples\first.pgn with the first.pgn in the folder pgn_samples and when I tried apgn first.pgn and apgn -engine "C:\analyse-pgn-1.1\stockfish.exe" first.pgn I moved first.pgn in the parent folder. It still gives the same error above

mrdcvlsc commented 4 months ago

@mhdshl82 wait you downloaded it from the link I gave in the markdown file right? because it seems that one is an older version

mrdcvlsc commented 4 months ago

@mhdshl82 wait you downloaded it from the link I gave in the markdown file right? because it seems that one is an older version

or maybe not since it looks like there's no significant changes between those versions from the git history, but anyways let me try to create a new compiled binary release from github actions


I also can't debug this problem really well since this is the Windows OS version of the program, I have transitioned to Ubuntu Linux a long time ago and I don't have any windows machine right now

mhdshl82 commented 4 months ago

@mhdshl82 wait you downloaded it from the link I gave in the markdown file right? because it seems that one is an older version

Yes I did. It was under releases. You seem to have removed now.

mhdshl82 commented 4 months ago

@mhdshl82 wait you downloaded it from the link I gave in the markdown file right? because it seems that one is an older version

or maybe not since it looks like there's no significant changes between those versions from the git history, but anyways let me try to create a new compiled binary release from github actions

I also can't debug this problem really well since this is the Windows OS version of the program, I have transitioned to Ubuntu Linux a long time ago and I don't have any windows machine right now

Thank you! At least, you know now that there is a problem with this executable.

mrdcvlsc commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

mhdshl82 commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

mrdcvlsc commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

I might have compiled it dynamically, I'll try again tomorrow or by another day, I'll compile it statically linked next time

mrdcvlsc commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

@mhdshl82 could you try the new windows compiled executable here again? this is a new one https://github.com/mrdcvlsc/analyse-pgn/releases/tag/working-add-ci-e81229e6c2b866637cb130b4a49416ecfb42db00

mhdshl82 commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

@mhdshl82 could you try the new windows compiled executable here again? this is a new one https://github.com/mrdcvlsc/analyse-pgn/releases/tag/working-add-ci-e81229e6c2b866637cb130b4a49416ecfb42db00

I tried it. Unfortunately, it did not work. it returns an empty first.analyzed.pgn
this is what it returns Engine : C:\windows-apgn-gcc(1)\build\bin\engines\stockfish.exe Threads : 1 Depth : 18 Color : A Moves : 0 Openning Moves to Skip : 0

NOTE: depth is set greater than 12!!! analysis might take longer...

Analysing first.pgn please wait... ... ... Analyzed PGN files: 1 it did not go through the game and analyzed at all.

mrdcvlsc commented 4 months ago

@mhdshl82 could you try the new windows binary in this pre-release? https://github.com/mrdcvlsc/analyse-pgn/releases

I tried it apgn first.pgn it returns the following windows popup message the procedure entry point _ZNKSt19_codecvt_utf8_baselwE10do_unshiftER9_MbstatetPcS3RS3 could not be located in the dynamic library C:windows-apgn-gcc\build\bin\analyse.exe and interrupts the process as if it finishes analyzing, so I get in one second analyzed file 1 but it returns an empty first.analyzed.pgn

@mhdshl82 could you try the new windows compiled executable here again? this is a new one https://github.com/mrdcvlsc/analyse-pgn/releases/tag/working-add-ci-e81229e6c2b866637cb130b4a49416ecfb42db00

I tried it. Unfortunately, it did not work. it returns an empty first.analyzed.pgn this is what it returns Engine : C:\windows-apgn-gcc(1)\build\bin\engines\stockfish.exe Threads : 1 Depth : 18 Color : A Moves : 0 Openning Moves to Skip : 0

NOTE: depth is set greater than 12!!! analysis might take longer...

Analysing first.pgn please wait... ... ... Analyzed PGN files: 1 it did not go through the game and analyzed at all.

It’s unfortunate that this problem might take some time to be solved. I’ll try to get my hands on a Windows PC this week, but I can’t promise that I’ll be able to fix it within that time

mrdcvlsc commented 2 months ago

I tried to fix this without my own windows device and only using github action windows OS runners, but failed miserably. In the new branch I updated the code and added a workflow for auto compilation, when running the program the error is gone but the analysis on windows does not produce text in the output file, I figure out that the problem was inside the windows PIPE implementation (winProcRun.hpp), If anyone wants contribute a fix that has a windows device please feel free to do so in the windows-pipe-fix branch.