Build cutechess with Qt5 static - xoto10/fishtest GitHub Wiki
Fishtest uses cutechess-cli, a command-line chess game manager. To maximize the compatibility with the workers running fishtest, use these instructions to build cutechess-cli.exe
static on Windows and cutechess-cli
with Qt5 static on Linux. The building process requires some time.
Running cutechess
To run cutechess in a way equivalent to fishtest use (linux example below):
./cutechess-cli -repeat -rounds 10000 -games 2 -tournament gauntlet \
-resign movecount=3 score=400 -draw movenumber=34 movecount=8 score=20 \
-concurrency 8 -openings file=noob_3moves.epd format=epd order=random plies=16 \
-engine name=base cmd=stockfish.base option.EvalFile=/home/user/nn-c157e0a5755b.nnue option."Use NNUE=true" \
-engine name=test cmd=stockfish.test option.EvalFile=/home/user/nn-c157e0a5755b.nnue option."Use NNUE=true" \
-ratinginterval 1 -each tc=10.0+0.1 proto=uci option.Threads=1 -pgnout result.pgn
The book noob_3moves.epd
can be downloaded from the books repo.
The EvalFile
is specific to the binary, can be downloaded from the network server, and must be specified with the full path. Look at ./cutechess-cli --help
for more options.
Windows
Download and install MSYS2 using the default settings and follow the official instructions to update the MSYS2 packages (here below the shortest way):
pacman -Syuu
to update the core packages, if request close the console pushing the top-right X buttonpacman -Syuu
to update the other packages
32 bit version (use this for fishtest)
- start a MSYS2 MinGW 32-bit console
- write and start this script:
#!/bin/bash
# http://stackoverflow.com/a/34001073/1583123
# update and install packages
pacman -S --noconfirm git make zip mingw-w64-i686-gcc mingw-w64-i686-jasper mingw-w64-i686-zstd mingw-w64-i686-qt5-static
# build cutechess-cli and cutechess
git clone https://github.com/cutechess/cutechess.git
cd cutechess
# checkout the latest tag
git fetch -p --tags --all
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $tag -b latest
git log --oneline -n 5 > ../cutechess.git.log
/mingw32/qt5-static/bin/qmake.exe -config release
make -j 4
strip projects/cli/cutechess-cli.exe
strip projects/gui/cutechess.exe
zip -j9 ../cutechess-cli-win.zip COPYING projects/cli/cutechess-cli.exe
64 bit version
- start a MSYS2 MinGW 64-bit console
- write and start this script:
#!/bin/bash
# http://stackoverflow.com/a/34001073/1583123
# update and install packages
pacman -S --noconfirm git make zip mingw-w64-x86_64-gcc mingw-w64-x86_64-jasper mingw-w64-x86_64-zstd mingw-w64-x86_64-qt5-static
# build cutechess-cli and cutechess
git clone https://github.com/cutechess/cutechess.git
cd cutechess
# checkout the latest tag
git fetch -p --tags --all
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $tag -b latest
git log --oneline -n 5 > ../cutechess.git.log
/mingw64/qt5-static/bin/qmake.exe -config release
make -j 4
strip projects/cli/cutechess-cli.exe
strip projects/gui/cutechess.exe
zip -j9 ../cutechess-cli-win-64bit.zip COPYING projects/cli/cutechess-cli.exe
Linux
Use Ubuntu 14.04 (32 bit and 64 bit) to build cutechess-cli for fishtest, in order to link the older versions of shared libraries. cutechess-cli tested working with several Linux distro (Ubuntu, CentOS, Debian, Fedora, OpenSuse, Arch, Gentoo, Clear Linux) and Windows Subsystem for Linux (Ubuntu, Debian, OpenSuse).
Write and start this script:
#!/bin/bash
# sudo bash make_cute.sh
# https://wiki.qt.io/Building_Qt_5_from_Git
# http://doc.qt.io/qt-5/linux-deployment.html
n_jobs=6
# update and install packages
apt update && apt full-upgrade -y
sudo apt-get -y build-dep qt5-default
apt install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
apt install -y build-essential perl python git zip
# build Qt5 static
git clone https://code.qt.io/qt/qt5.git
cd qt5
git checkout 5.10
perl init-repository --module-subset=default,-qtwebengine
mkdir /opt/qt5-static
./configure -static -release -opensource -confirm-license -prefix /opt/qt5-static -nomake examples -nomake tests -nomake tools -skip qtwebengine -no-icu
make -j ${n_jobs}
make -j ${n_jobs} install
# build cutechess-cli and cutechess
cd
git clone https://github.com/cutechess/cutechess.git
cd cutechess
# checkout the latest tag
git fetch -p --tags --all
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $tag -b latest
# comment out the Qt version check
sed -i '1,4{s/^/##/}' cutechess.pro
git log --oneline -n 5 > ../cutechess.git.log
/opt/qt5-static/bin/qmake -config release
make -j ${n_jobs}
strip projects/cli/cutechess-cli
strip projects/gui/cutechess
zip -j9 ../cutechess-cli-linux-$(getconf LONG_BIT)bit.zip COPYING projects/cli/cutechess-cli
Use this script to test the linux cutechess-cli
binaries with some major linux distributions:
#!/bin/bash
# use lxc/lxd on Ubuntu 18.04 or later
# sudo snap install lxd
# sudo lxd init
# accept all the defaults
# copy cutechess-cli binaries in "32" and "64" folders
_test_cute () {
echo ${1} ${2}
lxc launch ${1} c000
lxc file push ${2}/cutechess-cli c000/root/cutechess-cli
[ -z ${3} ](/xoto10/fishtest/wiki/--z-${3}-) || lxc exec c000 -- bash -c "${3}"
lxc exec c000 -- ldd cutechess-cli
lxc exec c000 -- ./cutechess-cli --version
lxc delete -f c000
}
_test_cute ubuntu:14.04 64
_test_cute ubuntu:16.04 64
_test_cute ubuntu:18.04 64
_test_cute ubuntu:20.04 64
_test_cute images:centos/6 64
_test_cute images:centos/7 64
_test_cute images:centos/8 64
_test_cute images:archlinux 64
_test_cute images:opensuse/15.1 64
_test_cute images:opensuse/15.2 64
# debian requires libglib2.0-dev
cmd_str="apt update && apt install -y libglib2.0-dev"
_test_cute images:debian/9 64 "${cmd_str}"
_test_cute images:debian/10 64 "${cmd_str}"
_test_cute images:debian/11 64 "${cmd_str}"
# gentoo requires libglib2.0-dev
cmd_str="emerge dev-libs/glib"
_test_cute images:gentoo 64 "${cmd_str}"
_test_cute images:fedora/31 64
_test_cute images:fedora/32 64
_test_cute ubuntu:14.04/i386 32
_test_cute ubuntu:16.04/i386 32
_test_cute ubuntu:18.04/i386 32
_test_cute images:centos/7/i386 32