Skip to content
On this page

Fishtest uses cutechess-cli, a command-line chess game manager. To maximize the compatibility with the workers running fishtest, use these instructions to build a static cutechess-cli binary for Windows and Linux. The building process requires some time, especially on Linux.

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=600 -draw movenumber=34 movecount=8 score=20 \
                -concurrency 8 -openings file=UHO_4060_v2.edp format=epd order=random plies=16 \
                -engine name=base cmd=stockfish.base option.EvalFile=/home/user/nn-ad9b42354671.nnue option."Use NNUE=true" \
                -engine name=test cmd=stockfish.test option.EvalFile=/home/user/nn-ad9b42354671.nnue option."Use NNUE=true" \
                -ratinginterval 1 -each tc=10.0+0.1 proto=uci option.Threads=1 -pgnout result.pgn

The book UHO_XXL_+0.90_+1.19.edp 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):

  1. pacman -Syuu to update the core packages, if request close the console pushing the top-right X button
  2. pacman -Syuu to update the other packages

32 bit version (use this for fishtest)

  1. start a MSYS2 MinGW 32-bit console
  2. write and start this script:
Click to view
bash
#!/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

  1. start a MSYS2 MinGW 64-bit console
  2. write and start this script:
Click to view
bash
#!/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 Alpine (tested with version 3.16) to build cutechess-cli for fishtest, at example with a lxd/lxc container on Ubuntu:

bash
sudo lxd init    # run once, accept all defaults
lxc launch images:alpine/3.16 alp
lxc file push make_cute.sh alp/root/make_cute.sh
lxc exec alp -- sh -ic "sh make_cute.sh > out &"
lxc exec alp -- tail -f out
lxc file pull alp/root/cutechess-cli-linux-64bit.zip cutechess-cli-linux-64bit.zip
lxc delete -f alp
# for 32 bit use:
# lxc launch images:alpine/3.16/i386 alp
# lxc file pull alp/root/cutechess-cli-linux-32bit.zip cutechess-cli-linux-32bit.zip

Write and start this script:

Click to view
bash
#!/bin/sh
# sudo sh make_cute.sh
# https://wiki.qt.io/Building_Qt_6_from_Git
# https://wiki.qt.io/Building_Qt_5_from_Git
# http://doc.qt.io/qt-5/linux-deployment.html
# https://github.com/qt/qt5

n_jobs=6
base_path=${PWD}
qt_source=${base_path}/qt5
qt_build=${base_path}/qt5-build
qt_install=/opt/qt5-static
cute_source=${base_path}/cutechess

mkdir -p ${qt_source}
mkdir -p ${qt_build}
mkdir -p ${qt_install}
mkdir -p ${cute_source}

apk add --update perl python3 git zip make g++ linux-headers mesa-dev

# build Qt static
git clone https://code.qt.io/qt/qt5.git ${qt_source}
cd ${qt_source}
git checkout v5.15.5-lts-lgpl
perl init-repository --module-subset=default,-qtwebengine
cd ${qt_build}
${qt_source}/configure -static -release -opensource -confirm-license -prefix ${qt_install} -nomake examples -nomake tests -nomake tools

make -j ${n_jobs}
make -j ${n_jobs} install

# build cutechess-cli
git clone https://github.com/cutechess/cutechess.git ${cute_source}
cd ${cute_source}

# 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

# skip gui build
sed -i "/SUBDIRS =/c\SUBDIRS = lib cli" projects/projects.pro
sed -i "/gui.depends/d" projects/projects.pro

${qt_install}/bin/qmake "QMAKE_LFLAGS += -static"

make -j ${n_jobs}
strip projects/cli/cutechess-cli
zip -j9 ${base_path}/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:

Click to view
#!/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} ]] || lxc exec c000 -- sh -ic "${3}"
lxc exec c000 -- ldd cutechess-cli
lxc exec c000 -- ./cutechess-cli --version
lxc delete -f c000
}

_test_cute images:almalinux/8 64
_test_cute images:almalinux/9 64

_test_cute images:alpine/3.13 64
_test_cute images:alpine/3.14 64
_test_cute images:alpine/3.15 64
_test_cute images:alpine/3.16 64
_test_cute images:alpine/edge 64

_test_cute images:archlinux 64

_test_cute images:centos/8-Stream 64
_test_cute images:centos/9-Stream 64

_test_cute images:debian/9 64
_test_cute images:debian/10 64
_test_cute images:debian/11 64
_test_cute images:debian/12 64
_test_cute images:debian/sid 64

_test_cute images:fedora/34 64
_test_cute images:fedora/35 64
_test_cute images:fedora/36 64

_test_cute images:gentoo/systemd 64

_test_cute images:opensuse/15.3 64
_test_cute images:opensuse/15.4 64
_test_cute images:opensuse/tumbleweed 64

_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 ubuntu:22.04 64

_test_cute images:voidlinux 64
_test_cute images:voidlinux/musl 64

_test_cute images:alpine/3.13/i386 32
_test_cute images:alpine/3.14/i386 32
_test_cute images:alpine/3.15/i386 32
_test_cute images:alpine/3.16/i386 32
_test_cute images:alpine/edge/i386 32

_test_cute images:debian/9/i386 32
_test_cute images:debian/10/i386 32
_test_cute images:debian/11/i386 32
_test_cute images:debian/12/i386 32
_test_cute images:debian/sid/i386 32

_test_cute images:opensuse/tumbleweed/i386 32

_test_cute ubuntu:14.04/i386 32
_test_cute ubuntu:16.04/i386 32
_test_cute ubuntu:18.04/i386 32

MacOs

Install Xcode or

  1. any other toolset that contains a C++-compiler and
  2. git (e.g. via Homebrew: brew install git).

Then start this script:

Click to view
bash
#!/bin/sh

n_jobs=6

# build Qt5 static
git clone https://code.qt.io/qt/qt5.git
cd qt5
git checkout 5.15
./init-repository --module-subset=default,-qtwebengine
mkdir ../qt5-static
./configure -static -release -opensource -confirm-license -prefix ../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
../qt5-static/bin/qmake -config release
make -j ${n_jobs}
zip -j9 ../cutechess-cli-macos-64bit.zip COPYING projects/cli/cutechess-cli

# cleanup
cd ..
rm -rf qt5
rm -rf qt5-static
rm -rf cutechess