Belofte  version 2.1.14
A promising chess program using the UCI or Winboard interface

How to compile, debug and test Belofte

This is the Building/Compiling/Debugging file for belofte, a promising chess program released under GNU - GPL v2.0.

Please refer to the manual for more information on using the program.


If the binaries for your platform are not released, or you want to create a custom build, you need to compile from source. Your toolset needs to support C++11. See C++ reference for more information.

cd project
make all

Alternatively (and preferred):

cd project
./ [--gcc|--clang] [--all|--32|--64] [--opt|--profile] [next]
  • --gcc: prefer gcc complier;
  • --clang: prefer clang compiler;
  • --all: build all targets, 32 and 64 bit (on 64 bit platform);
  • --32: build 32 bit target only;
  • --64: build 64 bit target only;
  • --opt: also generate optimized build (32/64) and a static build (64) for your machine;
  • --profile: build non optimized profilable build;
  • next: if not passed, will detect version number from source code.


By default, your platform is only configured to compile compatible programs. Therefore, on a 64 bit system, 32 bit compilation must be enabled manually first. See below. Not doing so will result in an error during compilation that can be ignored.

  • Compiling on Linux x64 for 32 or 64 bit with Clang or GCC installed, use
  • Installing Clang 32 target compilation on 64 bit Linux:
dnf install glibc-devel.i686
  • Installing environment for compiling (32 and 64 bit):
dnf install libstdc++-devel libstdc++-devel.i686
  • Installing static libraries for optimized builds (32 and 64 bit):
dnf install glibc-static glibc-static.i686 libstdc++-static libstdc++-static.i686

Replace dnf with yum/apt-get/... according to your linux flavour. Use sudo if required.

  • Compiling on Linux x86_64 with Code::Blocks installed: Open Code::Blocks project file, select target and build all or debug.
  • Compiling on Linux with NetBeans installed: Open NetBeans 8.02 or NetBeans 8.2, compile or debug.

Mac OS X

  • Compiling on Mac OS X with developer command line tools for Xcode installed, use


  • Compiling on Windows 64-bit with Code::Blocks installed: Open Code::Blocks project file, select target and build all or debug.
  • Compiling on Windows with Dev C++ installed: Open Dev C++ project (.dev) and build all. (warning, creates slow executable due to bundled gcc version.)
  • Compiling on Windows with other compilers: Compiler needs to support C++11, This means that following compilers will not work: Visual Studio Express, versions before Visual Studio 2015, Visual Studio Code, Borland C++ builder, Borland C++, ...

You cannot run or debug 64 bit code on a 32 bit platform.


  • Android builds are generated with ndk-build from Android NDK r22 Beta 1.
cd project/ndk-build


  • Install the Code::Blocks from the repository: Open Code::Blocks project file, select target w32 and build. Running not yet possible though.

Configuring belofte

When compiling, following conditionals (#define) can be turned on:

  • BELOFTE_NORANDOM: set modus to no random by default;
  • BELOFTE_TESTFUNCTION: to call testfunction during init;
  • BELOFTE_UCIMODE: creates a binary that defaults to UCI protocol;
  • BELOFTE_NOSIGNALS: suppress reaction to signals. (SIGINT, SIGTERM);
  • BELOFTE_NOUNICODE: compile for platforms that do not support UTF-8 console output, defined for Windows targets;
  • INCOMPLETE_C11: compile with compiler that does not support full C++11, defined for GCC before version 6;

Testing your compile

After compilation, it is always good to test if your conpile is correct. For this a numer of test suites are available.

Validating if no errors were introduced

Belofte supports epd to test a position. Launch epd pos, epd file commands with valid epd strings. Please refer to the documentation for more information.

cd test
./ belofte bmi2 2.1.4
belofte>epd file epd/perftsuite.epd

Belofte also supports executing commands from a command file. Use exec to run a test.

cd test
belofte>exec testcase/perft01.rc

Speed tests

Run benchmark:

cd test
./ belofte 2.1.4 --bench

Run benchmark against specific compile (i.e. GCC popcnt):

cd project
./ --gcc --all --opt
cd ../test
./ belofte popcnt 2.1.4 --bench

Cross platform tests

Run windows (32/64 bit) executable from linux through wine:

cd test
./ wine 64 2.1.4 --version