Compiling cutechess-cli in Window XP

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Compiling cutechess-cli in Window XP

Post by Adam Hair »

I have been unsuccessful in compiling cutechess-cli (using the latest source from GitHub), and I do not know why. I have tried using Qt 4.84 to create the makefile' and use MinGW 4.4 to compile the source. This is the output:

Code: Select all

C:\Documents and Settings\Administrator\My Documents\Downloads\New_downloads\cutechess-master\cutechess-master\projects\cli>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/Administrator/My Documents/Downloads/New_downloads/cutechess-master/cutechess-master/projects/cli'
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\main.o src\main.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\cutechesscoreapp.o src\cutechesscoreapp.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\enginematch.o src\enginematch.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\matchparser.o src\matchparser.cpp
C:\Qt\4.8.4\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -D__GNUC__ -DWIN32 src\enginematch.h -o .moc\moc_enginematch.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\moc_enginematch.o .moc\moc_enginematch.cpp
C:\Qt\4.8.4\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -D__GNUC__ -DWIN32 src\cutechesscoreapp.h -o .moc\moc_cutechesscoreapp.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\moc_cutechesscoreapp.o .moc\moc_cutechesscoreapp.cpp
c:\Qt\4.8.4\bin\rcc.exe -name doc res\doc\doc.qrc -o .rcc\qrc_doc.cpp
g++ -c -pipe -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.4\include\QtCore" -I"c:\Qt\4.8.4\include" -I"..\lib\src" -I"c:\Qt\4.8.4\include\ActiveQt" -I".moc" -I"c:\Qt\4.8.4\mkspecs\default" -o .obj\qrc_doc.o .rcc\qrc_doc.cpp
g++ -Wl,-subsystem,console -mthreads -o cutechess-cli.exe .obj/main.o .obj/cutechesscoreapp.o .obj/enginematch.o .obj/matchparser.o .obj/moc_enginematch.o .obj/moc_cutechesscoreapp.o .obj/qrc_doc.o  -L"c:\Qt\4.8.4\lib" -lcutechess "-LC:/Documents and Settings/Administrator/My Documents/Downloads/New_downloads/cutechess-master/cutechess-master/projects/lib" -lQtCored4
c:/documents and settings/administrator/my documents/downloads/new_downloads/mingw-gcc440_1/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lcutechess
collect2: ld returned 1 exit status
mingw32-make[1]: *** [cutechess-cli.exe] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/Administrator/My Documents/Downloads/New_downloads/cutechess-master/cutechess-master/projects/cli'
mingw32-make: *** [debug] Error 2

C:\Documents and Settings\Administrator\My Documents\Downloads\New_downloads\cutechess-master\cutechess-master\projects\cli>
I do not know what '-lcutechess' refers to, nor where to locate it.


I have also tried using Qt 5.0.2 and MinGW 4.7.2:

Code: Select all

C:\Documents and Settings\Administrator\My Documents\Downloads\New_downloads\cut
echess-master\cutechess-master\projects\cli>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Documents and Settings/Administrator/My
Documents/Downloads/New_downloads/cutechess-master/cutechess-master/projects/cli
'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -m
threads -DUNICODE -DLIB_EXPORT=__declspec(dllimport) -DCUTECHESS_CLI_VERSION=\"0
.5.1\" -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I'../lib/src' -I'../../../../../../../..
/../Qt/Qt5.0.2/5.0.2/mingw47_32/include' -I'../../../../../../../../../Qt/Qt5.0.
2/5.0.2/mingw47_32/include/QtCore' -I'.moc' -I'../../../../../../../../../Qt/Qt5
.0.2/5.0.2/mingw47_32/mkspecs/win32-g++' -o .obj/main.o src/main.cpp
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wa
ll -Wextra -fexceptions -mthreads -DUNICODE -DLIB_EXPORT=__declspec(dllimport) -
DCUTECHESS_CLI_VERSION=\"0.5.1\" -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I'../lib/src'
-I'../../../../../../../../../Qt/Qt5.0.2/5.0.2/mingw47_32/include' -I'../../../.
./../../../../../Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtCore' -I'.moc' -I'../../.
./../../../../../../Qt/Qt5.0.2/5.0.2/mingw47_32/mkspecs/win32-g++' -o .obj/main.
o src/main.cpp'
Makefile.Release:404: recipe for target '.obj/main.o' failed
mingw32-make[1]: *** [.obj/main.o] Error 258
mingw32-make[1]: Leaving directory 'C:/Documents and Settings/Administrator/My D
ocuments/Downloads/New_downloads/cutechess-master/cutechess-master/projects/cli'

Makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2

C:\Documents and Settings\Administrator\My Documents\Downloads\New_downloads\cut
echess-master\cutechess-master\projects\cli>
I would ask Ilari directly, but I do not think he typically uses Windows.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Compiling cutechess-cli in Window XP

Post by ilari »

Hi,

'-lcutechess' means the cutechess library (cutechess.dll) which is needed by cutechess-cli. The easiest way to compile everything (lib, cli and gui) is to run qmake and make in the root cutechess folder. You can also build cutechess-cli and cutechess library into the same binary by running qmake with the "-config static" argument.

You could also just download the binary package that I made for the Stockfish testing framework: http://koti.mbnet.fi/~ilaripih/bin/cute ... -win32.zip
It's based on the latest commit at Github, so it's definitely bleeding edge, but apparently working quite well (over 4 million games played without any problems that I'm aware of).
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Compiling cutechess-cli in Window XP

Post by Jim Ablett »

When compiling with Mingw32 I needed to change something in the GTB src - sysport.h' '.
__MINGW32__' instead of 'MINGW' otherwise build fails looking for 'sys/resource.h'

Jim.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Compiling cutechess-cli in Window XP

Post by Adam Hair »

ilari wrote:Hi,

'-lcutechess' means the cutechess library (cutechess.dll) which is needed by cutechess-cli. The easiest way to compile everything (lib, cli and gui) is to run qmake and make in the root cutechess folder. You can also build cutechess-cli and cutechess library into the same binary by running qmake with the "-config static" argument.

You could also just download the binary package that I made for the Stockfish testing framework: http://koti.mbnet.fi/~ilaripih/bin/cute ... -win32.zip
It's based on the latest commit at Github, so it's definitely bleeding edge, but apparently working quite well (over 4 million games played without any problems that I'm aware of).

Hi Ilari,

I have been using the binary used in the Stockfish testing, and I have had no problems. In fact, if it is possible to change the drawelo value in that binary from the commandline, or if the drawelo value has been changed to a value closer to 240, then I will have no reason to try to compile the source. If this is not the case, then I will have to determine how to compile it.

After your first response, I realized that cutechess.dll was needed and that it had to be located in the Qt folder (I think). Now, I am having trouble with the sysport.c file when compiling (I will include the compiler output at the end of the post). Perhaps if you could tell me which compiler and which version of Qt you use to compile cutechess in Windows, I could start from scratch and try again.

Code: Select all

gcc -c -pipe -g -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DLIB_EXPORT=__declspec(dllexport) -DZ_PREFIX -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\Qt\4.8.4\include\QtCore" -I"..\..\..\Qt\4.8.4\include" -I"src" -I"components\json\src" -I"3rdparty\gtb\src" -I"..\..\..\Qt\4.8.4\include\ActiveQt" -I".moc" -I"..\..\..\Qt\4.8.4\mkspecs\default" -o .obj\sysport.o 3rdparty\gtb\src\sysport\sysport.c
3rdparty\gtb\src\sysport\sysport.c:52:27: error: sys/resource.h: No such file or directory
3rdparty\gtb\src\sysport\sysport.c: In function 'mysys_fopen_max':
3rdparty\gtb\src\sysport\sysport.c:62: error: storage size of 'rl' isn't known
3rdparty\gtb\src\sysport\sysport.c:63: warning: implicit declaration of function 'getrlimit'
3rdparty\gtb\src\sysport\sysport.c:63: error: 'RLIMIT_NOFILE' undeclared (first use in this function)
3rdparty\gtb\src\sysport\sysport.c:63: error: (Each undeclared identifier is reported only once
3rdparty\gtb\src\sysport\sysport.c:63: error: for each function it appears in.)
3rdparty\gtb\src\sysport\sysport.c:62: warning: unused variable 'rl'
mingw32-make[3]: *** [.obj/sysport.o] Error 1
mingw32-make[3]: Leaving directory `C:/cutechess-master/projects/lib'
mingw32-make[2]: *** [debug] Error 2
mingw32-make[2]: Leaving directory `C:/cutechess-master/projects/lib'
mingw32-make[1]: *** [sub-lib-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `C:/cutechess-master/projects'
mingw32-make: *** [sub-projects-make_default] Error 2

C:\cutechess-master>
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Compiling cutechess-cli in Window XP

Post by Adam Hair »

Jim Ablett wrote:When compiling with Mingw32 I needed to change something in the GTB src - sysport.h' '.
__MINGW32__' instead of 'MINGW' otherwise build fails looking for 'sys/resource.h'

Jim.
I will give that a try.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Compiling cutechess-cli in Window XP

Post by Adam Hair »

I would like to be certain if I read your statement correctly, Jim. Do I replace 'MINGW' in the sysport.h file with '_MINGW32_' or with '._MINGW32_' ?
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Compiling cutechess-cli in Window XP

Post by Jim Ablett »

Adam Hair wrote:I would like to be certain if I read your statement correctly, Jim. Do I replace 'MINGW' in the sysport.h file with '_MINGW32_' or with '._MINGW32_' ?

__MINGW32__


I didn't have any other issues building with static or shared libraries.
Are you sure your QT environment is set correctly?

http://sector.ynet.sk/qt4-tutorial/preparations.html

Jim.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Compiling cutechess-cli in Window XP

Post by Adam Hair »

Jim Ablett wrote:
Adam Hair wrote:I would like to be certain if I read your statement correctly, Jim. Do I replace 'MINGW' in the sysport.h file with '_MINGW32_' or with '._MINGW32_' ?

__MINGW32__


I didn't have any other issues building with static or shared libraries.
Are you sure your QT environment is set correctly?

http://sector.ynet.sk/qt4-tutorial/preparations.html

Jim.
That was what I thought. Unfortunately, it still failed for me while looking for 'sys/resource.h'.

I am fairly certain that I have it set correctly, but I will read over the link you provided to see if I made a mistake.
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Compiling cutechess-cli in Window XP

Post by Jim Ablett »

Adam Hair wrote:
Jim Ablett wrote:
Adam Hair wrote:I would like to be certain if I read your statement correctly, Jim. Do I replace 'MINGW' in the sysport.h file with '_MINGW32_' or with '._MINGW32_' ?

__MINGW32__


I didn't have any other issues building with static or shared libraries.
Are you sure your QT environment is set correctly?

http://sector.ynet.sk/qt4-tutorial/preparations.html

Jim.
That was what I thought. Unfortunately, it still failed for me while looking for 'sys/resource.h'.

I am fairly certain that I have it set correctly, but I will read over the link you provided to see if I made a mistake.
There are about five places in sysport.h where you must change it.
Make sure you are using mingw32-make and not make.
Do a 'mingw32-make clean' and then mingw32-make.

Jim.
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: Compiling cutechess-cli in Window XP

Post by Adam Hair »

According to the tutorial, I needed to add two environment variables, so I did as it directed, then I rebooted. In 'sysport.h', I replaced all 5 instances of 'MINGW' with '_MINGW32_'. I ran 'mingw32-make clean', then ran 'mingw32-make'. Then, I pulled my hair out :lol: because 'sys/resource.h' was not found.

I am using Qt 4.8.4 and MinGW 4.40. Since I am confident that Qt is installed properly, I am going to redownload with MinGW and try again.