Open tissatussa opened 4 months ago
trying to repair some old C code of a chess engine called Hoplite, i consult ChatGPT, which is often a great help to me while coding. It states compilation can be 'extended' by adding debug info like this :
DFLAGS = -g -DDEBUG
ChatGPT : when the -g flag is added, it includes debugging information in the binary. This information helps tools like 'gdb' provide detailed insights into your program's execution, such as variable values and stack traces. The debugging information significantly increases the binary size because it contains additional metadata.
probably you already know this, but anyhow. can we solve the problem this way ?
If you compile with -DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Debug
, it should enable debugging... Everything works fine on the terminal through linux and with the macos version of cutechess. I could try cutechess on linux soon though. Let me know if you find anything
i compiled your newest source with the 2 commands of the README, and all went well : no warnings and errors. A valid binary of 97.8 Kb was created, which runs fine in terminal but .. not in CuteChess GUI.
i tried the GUI of CuteChess 1.3.1 (newest, although i think they're almost launching 1.4.0) which i use for all engines, and also the older (but stable) v1.2.0, both have the same problem : they can't initialise Prometheus.
here's the output of my lldb
debugger (i also tested with gdb
but it gives no meaningful output) :
$ lldb-17 /home/roelof/Apps/cutechess-1.3.1/cutechess-gui
(lldb) target create "/home/roelof/Apps/cutechess-1.3.1/cutechess-gui"
Current executable set to '/home/roelof/Apps/cutechess-1.3.1/cutechess-gui' (x86_64).
(lldb) run
Process 310967 launched: '/home/roelof/Apps/cutechess-1.3.1/cutechess-gui' (x86_64)
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 4786, resource id: 11429164, major code: 40 (TranslateCoords), minor code: 0
Process 310967 stopped and restarted: thread 15 received signal: SIGCHLD
Terminating process of engine Prometheus v0.2(1)
when i compile with -DCMAKE_BUILD_TYPE=Release
, does it really include debug info ? Why don't the debuggers give more info ? Shouldn't the argument be something like -DCMAKE_BUILD_TYPE=Debug
? I'm stuck, most compiled engines have no such problem. I'm on Xubuntu 22.04, i think you should test on Linux to reproduce the issue .. i have no Apple nor Windows PC to test on.
i have more info, maybe it helps. the CuteChess config file (~/.config/cutechess/engines.json) contains this section for your engine :
{
"command" : "./prometheus-v0.2-compiled-HP",
"name" : "Prometheus v0.2",
"options" : [
{
"alias" : "",
"default" : 64,
"max" : 4096,
"min" : 1,
"name" : "Hash",
"type" : "spin",
"value" : 64
}
],
"protocol" : "uci",
"stderrFile" : "/home/roelof/Apps/ChessEngines/Prometheus/myerror.txt",
"timeoutScaleFactor" : 1,
"workingDirectory" : "/home/roelof/Apps/ChessEngines/Prometheus"
},
normally the entry 'stderrFile' is empty, but here i set a file to log errors and indeed some error was logged :
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoul
that's all CuteChess GUI gave.
normally i have no troubles with engines in CuteChess GUI, so this is strange to me .. i will now try CuteChess on the commandline (which i never do) and post the result here - i'll be back soon.
the test in CuteChess-cli went well !? this was my command :
./cutechess-cli -engine name="Prometheus v0.2" cmd=./prometheus-v0.2-compiled-HP dir=./ timemargin=1000 tc=80/180+3 proto='uci' -engine name="4KU v4.0" cmd=./4ku_v4.0-PR291_compiled_HP dir=./ timemargin=1000 tc=80/180+3 proto='uci' -resultformat default -wait 5000 -debug -rounds 2 -games 4
You're right, it should be -DCMAKE_BUILD_TYPE=Debug
, sorry. I will have to try cutechess on linux for myself.
hi, did you make any progress solving this Issue ? Working on a new version ?
i just found your chess engine at https://chessengines.blogspot.com/2024/07/new-version-chess-engine-prometheus-02.html .. then i found your GitHub page : it mentions 0.1, not 0.2 .. but after compiling your current main source, the binary shows 0.2 (by the
uci
command) .. i guessed the authors of chessengines.blogspot.com had copied that source package, but at closer inspection many files are different !?i also compiled the 0.2 package from chessengines.blogspot.com, but both
0.2
binaries can not be initialized in CuteChess :however, execution in terminal goes well .. here's my test, just like CuteChess does it :
Btw. you should remove the line "time:.. start:.. stop:.. depth:.. timeset:.." because such output is not according to the UCI protocol : display such line with prefix "info string" to suit UCI. I removed the line and compiled again, but it didn't help.
compiling the asset source package 0.1 went well .. the resulting binary indeed shows "0.1" and it runs fine in CuteChess GUI. I used the newest
cmake
version 3.29.2i tried to find the cause of the init-error by running the CuteChess GUI in a debugger (i use both
lldb
andgdb
on Linux) but i get no clue.lldb-17
shows this when the initialization fails :gdb
shows no valuable info when the initialization fails.another thing : to compile the current
main
package, i had to solve this error :the repair was easy :
u64 Board::perft(int)
insrc/board/board.cpp
(line 891) is defined differently insrc/board/board.h
. I also had a few warnings, but they're not important (however, i repaired the concerning code and it didn't solve the init error).last thing : your asset binary seems an Apple one .. you should mention that somehow.
[ i'm on Xubuntu 22.04 ]