Chess for Android: UCI engine options

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

Moderators: hgm, Rebel, chrisw

User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Chess for Android: UCI engine options

Post by abik »

The UCI engine setup dialog in Chess for Android was developed a long time ago when there were not many chess engines available for Android. As a result, I opted for a simple dialog that featured a few, commonly used UCI engine options only (such as hash table size, number of threads, endgame tablebases). However, the options that I picked almost ten years ago no longer serve the wide variety in options of the many chess engines available for Android.

Therefore, I decided to re-implement the UCI engine setup and do what the UCI protocol specification actually intended: the GUI should parse all options and build a dialog that allows the user to change them. For engines with only a few options, this yields a concise dialog, as illustrated below with BikJump v1.8. For engines with many options, this yields a more elaborate, scrollable dialog, as illustrated below for Leela Chess Zero. In any case, however, the new implementation gives the user full access to all options!

Expect this new feature to go into production very soon. A few comments on issues that could be improved.
  • As before, the options setup is a one time procedure for each engine. Individual options can only be changed by first clearing the options for that engine, and starting again. I may add a "change options" feature at some point, so that not all parameters need to be revisited each time.
  • The UCI protocol specification recommends omitting certain options that are best handled elsewhere. For now, I opted for showing all options at once.
  • The options setup is associated with an engine binary. Perhaps in the future I may allow setting up a single binary with different options, and giving each configuration a new name.
ImageImageImage
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

Aart,

I am not able to load my engines compiled for android in your GUI. I was also not able to run toga-for-android from Michel's website but
the robbolito binary works for me. What used to work about 6 years ago for me (last time i tried it) now doesn't seem to work.
What has changed since then? I am suing cross-compiler toolchain from Android NDK to compile binaries and I get this:

Code: Select all

NebiyuChess: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/, stripped
Do I also need to make it statically linked as well now ?

Daniel
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

Daniel Shawul wrote: Mon May 27, 2019 3:57 am I am not able to load my engines compiled for android in your GUI. I was also not able to run toga-for-android from Michel's website but
the robbolito binary works for me. What used to work about 6 years ago for me (last time i tried it) now doesn't seem to work.
What has changed since then? I am suing cross-compiler toolchain from Android NDK to compile binaries and I get this:
If it has been six year, and assuming you upgraded your device or at least your Android version in the meanwhile, perhaps you missed this older thread? You may also find this thread informative.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

Ok thanks! Now i 've compiled with -static option and a different compiler this time : the arm-linux-gnueabi-g++

Code: Select all

arm-linux-gnueabi-g++ -O3 -std=c++11 -Wno-unused-result -Wno-psabi -march=armv7 -static *.cpp -lpthread -lm -o scorpio
I get a binary like

Code: Select all

scorpio: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=5e49df6d7e93764d58c9ea41ab53f2af613bb933, with debug_info, not stripped
After loading i see the message "scorpio: ready" on the bottom left corner but then it always resigns on the first move it has to make
out of book. What could be the problem ?

Daniel
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

Going back to using Android's own NDK clang compiler, I found an issue with compiling c++ codes.

C code works fine

Code: Select all

daniel@dani-s-xp:~$ cat hello.c
#include <stdio.h>
int main () {
  puts("hello world");
}
daniel@dani-s-xp:~$ arm-linux-androideabi-gcc -pie hello.cpp
daniel@dani-s-xp:~$ adb push a.out /data/local/tmp/.
a.out: 1 file pushed. 4.6 MB/s (100852 bytes in 0.021s)
daniel@dani-s-xp:~$ adb shell "./data/local/tmp/a.out"
hello world
C++ code has problems -- missing "libc++_shared.so"

Code: Select all

daniel@dani-s-xp:~$ cat hello.cpp
#include <stdio.h>
int main () {
  puts("hello world");
  return 0;
}
daniel@dani-s-xp:~$ arm-linux-androideabi-g++ -pie hello.cpp
daniel@dani-s-xp:~$ adb push a.out /data/local/tmp/.
a.out: 1 file pushed. 6.5 MB/s (100852 bytes in 0.015s)
daniel@dani-s-xp:~$ adb shell "./data/local/tmp/a.out"
CANNOT LINK EXECUTABLE "./data/local/tmp/a.out": library "libc++_shared.so" not found
The same issue is mentioned here

Daniel
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

On the other hand, arm-linux-gnueabi-g++ does not have a problem with c or cpp files and it produces a "binary".
However, there are many issues with the scorpio binary produced by it. It runs and exits with errors like below which
I don't know where to start debugging from

Code: Select all

go
# rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
# [st = 11114ms, mt = 29250ms , hply = 0 , moves_left 10]
terminate called after throwing an instance of '__gnu_cxx::__concurrence_broadcast_error'
  what():  __gnu_cxx::__concurrence_broadcast_error
I think the arm-linux-gnueabi-g++ is not supported by Google anymore. So my best bet is probably to find a way to resolve issues with clang++
despite the fact that g++ got me sort of an executable.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

Finally got it working with an ancient arm-linux-androideabi-g++ from r12. They are now at r20 so it is pretty old.
What a pain this android compilation is.
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

Daniel Shawul wrote: Mon May 27, 2019 6:45 pm Finally got it working with an ancient arm-linux-androideabi-g++ from r12. They are now at r20 so it is pretty old.
Can you please send me the latest engine binary? I can test run it on a few of my devices. Will also be fun to test the new UCI options setup :-)
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Chess for Android: UCI engine options

Post by Daniel Shawul »

Download here.
Note that it is an xboard engine. It didn't display the options window when i loaded it in chess for android, but i was able to play with it.
It has lots of "feature options" just like uci engines, so you can use it to debug when you support displaying options table for
xboard engines as well.
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

Daniel Shawul wrote: Mon May 27, 2019 10:25 pm Download here.
Note that it is an xboard engine. It didn't display the options window when i loaded it in chess for android, but i was able to play with it.
It has lots of "feature options" just like uci engines, so you can use it to debug when you support displaying options table for
xboard engines as well.
Runs great on my Pixel C (Android Oreo) and Pixel 2 (Android Pie). I forgot scorpio is Xboard. Perhaps it is also time to support more features for XBoard, I have to read up on that a bit.