Chess2u
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Chess2uLog in

Compiling Chess Engines for Android with Termux

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Archimedes wrote:
GsauceCries wrote:
Can I ask how to compile an engine in termux for armv7? I cannot find Shashchess 16 here in this forum so I want to do it by myself since I want to use a specific 20mb net.

Source:
https://github.com/amchess/ShashChess/releases/tag/16

There are different ways to do that: g++, clang++ or Android NDK. At first, you need an installation of one of this compilers. ShashChess is not the easiest starting point, to learn, how to compile on Termux. Additional there are some changes to the source code necessary. Do you have experience with compilations on Termux (e. g. Stockfish)? However, i can provide a makefile or files for Android NDK for proper compiling.

http://outskirts.altervista.org/forum/viewtopic.php?f=40&t=2685



I have experience compiling Stockfish dev source from abrok for Android armv7 since there are many instructional videos out there. I am just really having a hard time compiling when I am trying to create an armv7 from a makefile of other stockfish derivatives since I am not very familiar with them. Thanks for the help Archimedes! It might also help others viewing this thread.

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Hi dear Archimedes,

I'm trying to compile ProteusChessSFv005 using your batch script for v004, but I get an error on Polyglot (that I have not modified):

Start ndk-build [y]? y

[arm64-v8a] Compile++ : ProteusChessSF <= benchmark.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= bitbase.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= bitboard.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= endgame.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= evaluate.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= main.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= material.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= misc.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= movegen.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= movepick.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= pawns.cpp
[arm64-v8a] Compile++ : ProteusChessSF <= polybook.cpp
C:/ProteusChessSF/jni/../src/polybook.cpp:25:10: fatal error: 'sys/timeb.h' file not found
#include <sys/timeb.h>
^~~~~~~~~~~~~
1 error generated.
make: *** [C:/ProteusChessSF/android-ndk/build//../build/core/build-binary.mk:478: C:/ProteusChessSF/obj/local/arm64-v8a/objs/ProteusChessSF/__/src/polybook.o] Error 1

This is the new source v005 that compiles fine on Windows and Mac M1 : https://onedrive.live.com/?cid=B0F797063D1EB745&id=B0F797063D1EB745%2110910&parId=B0F797063D1EB745%2110657&o=OneUp

Could you tell me where I'm wrong?

Could you share also ProteusChessSFv005 build in your topic and in your monthly engines collection for all our friends here?

Thank you in advance, Alex

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Hi dear Archimedes,

I'm trying to compile ProteusChessSFv005 using your batch script for v004, but I get an error on Polyglot (that I have not modified):

Start ndk-build [y]? y

[arm64-v8a] Compile++      : ProteusChessSF <= benchmark.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= bitbase.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= bitboard.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= endgame.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= evaluate.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= main.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= material.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= misc.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= movegen.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= movepick.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= pawns.cpp
[arm64-v8a] Compile++      : ProteusChessSF <= polybook.cpp
C:/ProteusChessSF/jni/../src/polybook.cpp:25:10: fatal error: 'sys/timeb.h' file not found
#include <sys/timeb.h>
        ^~~~~~~~~~~~~
1 error generated.
make: *** [C:/ProteusChessSF/android-ndk/build//../build/core/build-binary.mk:478: C:/ProteusChessSF/obj/local/arm64-v8a/objs/ProteusChessSF/__/src/polybook.o] Error 1

This is the new source v005 that compiles fine on Windows and Mac M1 : https://onedrive.live.com/?cid=B0F797063D1EB745&id=B0F797063D1EB745%2110910&parId=B0F797063D1EB745%2110657&o=OneUp

Could you tell me where I'm wrong?

Could you also share ProteusChessSFv005 build in your topic and in your monthly engines collection for all our friends here?

Thank you in advance, Alex

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
In polybook.cpp change "#include <sys/timeb.h>" to

Code:

// #include <sys/timeb.h>

or delete the line for proper compiling to Android.

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Archimedes wrote:
In polybook.cpp change "#include <sys/timeb.h>" to

Code:

// #include <sys/timeb.h>

or delete the line for proper compiling to Android.


Thank you. Works!

It's nice to have so skilled friends like you!

Kind regards, Alex

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
AlexChess wrote:
Archimedes wrote:
In polybook.cpp change "#include <sys/timeb.h>" to

Code:

// #include <sys/timeb.h>

or delete the line for proper compiling to Android.


Thank you. Works!

It's nice to have so skilled friends like you!

Kind regards, Alex


With your "ready to go package" you can also compile Stockfish. Just change the name of the executable (LOCAL_MODULE) in Android.mk.

Speed differences between Android NDK (which uses the clang compiler) and gcc in combination with PGO on Termux are very small.

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Archimedes wrote:
AlexChess wrote:
Archimedes wrote:
In polybook.cpp change "#include <sys/timeb.h>" to

Code:

// #include <sys/timeb.h>

or delete the line for proper compiling to Android.


Thank you. Works!

It's nice to have so skilled friends like you!

Kind regards, Alex


With your "ready to go package" you can also compile Stockfish. Just change the name of the executable (LOCAL_MODULE) in Android.mk.

Speed differences between Android NDK (which uses the clang compiler) and gcc in combination with PGO on Termux are very small.


Hi dear Archimedes!

FatTitz 2 has different compiling rules from standard SF derivatives, due to the NNUE or other code changes?

Thank you in advance, Alex

Start ndk-build [y]? y

[arm64-v8a] Executable : FatFriz2
ld: error: undefined symbol: main
>>> referenced by crtbegin.c
>>> C:/FatTitz2/android-ndk/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/21\crtbegin_dynamic.o:(_start_main)
>>> referenced by crtbegin.c
>>> C:/FatTitz2/android-ndk/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/21\crtbegin_dynamic.o:(_start_main)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [C:/FatTitz2/android-ndk/build//../build/core/build-binary.mk:728: C:/FatTitz2/obj/local/arm64-v8a/FatFriz2] Error 1

Premere un tasto per continuare . . .


descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
AlexChess wrote:
FatTitz 2 has different compiling rules from standard SF derivatives, due to the NNUE or other code changes?

Android.mk in your jni directory (in your "ready to go package") is only designed for Stockfish based compilation. Every chess engine needs its own Android.mk. You have to change the parameter accordingly.

Fat Titz is written in C. First action will be, delete the last line in Application.mk. Fat Titz is a fork of Cfish. You have to change the source code for proper compiling with Android NDK. May be, it is better to compile it with the clang compiler on Termux by using the makefile (seems to be the easiest way).

descriptionCompiling Chess Engines for Android with Termux - Page 3 EmptyRe: Compiling Chess Engines for Android with Termux

more_horiz
Permissions in this forum:
You cannot reply to topics in this forum