Page 3 of 3

Re: building for Android

Posted: Thu Apr 20, 2017 9:08 pm
by jdart
/data/local seems to not be accessible on my phone.

--Jon

Re: building for Android

Posted: Fri Apr 21, 2017 11:23 am
by pedrox
jdart wrote:/data/local seems to not be accessible on my phone.

--Jon
I am sorry. This worked on my phone that does not have root, maybe the rom is pre-rooted.

Re: building for Android

Posted: Sun Apr 23, 2017 11:33 pm
by abik
I pulled your tree from github and had not too much trouble making a position-independent executable with the NDK compiler toolchain. I am not sure what scripts you are using, but perhaps using the compiler directly will help, since it works for me.

Code: Select all

# ./arasanx-ab                                          
Arasan 20.0-ab Copyright 1994-2017 by Jon Dart. All Rights Reserved.
uci
id name Arasan 20.0-ab
id author Jon Dart
option name Hash type spin default 32 min 4 max 2000
option name Ponder type check default true
option name MultiPV type spin default 1 min 1 max 10
option name OwnBook type check default true
option name Book selectivity type spin default 50 min 0 max 100
option name Threads type spin default 1 min 1 max 64
option name UCI_LimitStrength type check default false
option name UCI_Elo type spin default 2600 min 1000 max 2600
uciok
go
info multipv 1 depth 1 score cp 58 time 0 nodes 0 hashfull 0 pv e2e3
info multipv 1 depth 1 score cp 58 time 1 nodes 21 hashfull 0 pv e2e3
info multipv 1 depth 2 score cp 0 time 6 nodes 467 hashfull 0 pv e2e3 e7e6
info multipv 1 depth 3 score cp 54 time 11 nodes 1045 hashfull 0 pv e2e3 d7d5 b1c3
info multipv 1 depth 3 score cp 54 time 11 nodes 1045 hashfull 0 pv e2e3 d7d5 b1c3
bestmove e2e3 ponder d7d5

Re: building for Android

Posted: Sun Jan 07, 2018 10:27 pm
by Ras
jdart wrote:I downloaded the NDK and followed the instructions to set up a standalone toolchain. I used this command:

$NDK/build/tools/make_standalone_toolchain.py --install-dir=/home/jdart/chess/chess/android-toolchain-clang --arch arm --api 9 --stl=libc++
I know this thread is a bit dated, but there's a gotcha: the PIE position independent code is required from Android 5.0, but it is only supported from API level 16 onwards. Generating the toolchain with API level 9 is likely not to work.

Re: building for Android

Posted: Sun Jan 07, 2018 11:08 pm
by jdart
Thanks for the hint. I am going to revisit this eventually. However, last I tried it I was stuck at the last issue I mentioned: getting the executable on to the one Android device I have (Samsung Galaxy S7) in a form that is runnable there.

--Jon

Re: building for Android

Posted: Mon Jan 08, 2018 12:29 am
by Ras
jdart wrote:Thanks for the hint. I am going to revisit this eventually.
I'm not familiar with C++ and its implications for Android; however, my C-engine works under PC-Linux, and from there, it was easy to get an Android build done. In fact so easy that I managed to do it although I don't even own an Android device.

The workflow is, for Windows:
- copying the Android NDK to the host.
- using the build/tools/make_standalone_toolchain.py script with the correct parameters.
- having a build script that uses the resulting tool chain.

I'm using NDK 15c because 16b seems to have some issues with x86 Android, not quite sure here what it is. But for Galaxy S7, that doesn't matter anyway.

It seems that using e.g. Chess for Android, all you have to to is to put the engine on the SD card and then use the "install engine from SD card" feature. Aart has figured out all the complicated stuff, so as engine programmer, it's just providing a runnable executable.