Compiling for Android

Moderators: Elijah, Igbo, timetraveller

Archimedes

Android Engines Top Active Users
Forum Contributions
Points: 42 582,00 
Posts: 2059
Joined: 04/11/2019, 21:13
Status: Offline (Active 4 Hours, 17 Minutes ago)
Medals: 2
Topics: 158
Reputation: 7111
Been thanked: 6477 times

Re: Compiling for Android

Post by Archimedes »

Kepcuk wrote: 12/04/2023, 9:31 clang-16: error: unknown argument: '-fexperimental-new-pass-manager'
As an alternative use the makefile I use for CfishNN (the source code is included in the zip archive). But it is only for arm64-v8a.

Code: Select all

make net
make profile-build COMP=clang
Kepcuk
I've been banned!
Points: 6 000,00 
Posts: 45
Joined: 01/02/2023, 13:20
Status: Offline (Active 10 Months, 3 Weeks, 5 Days, 19 Hours, 1 Minute ago)
Topics: 9
Reputation: 18
1
Has thanked: 9 times
Been thanked: 51 times

Re: Compiling for Android

Post by Kepcuk »

Thanks to all for helping. Can we embed ini settings file to engine? Also Archimedes can u look for requests? Thanks :sm73:
angel44e
Forum Contributions
Points: 11 227,00 
Posts: 135
Joined: 19/04/2023, 16:17
Status: Offline (Active 2 Weeks, 4 Days, 7 Hours, 24 Minutes ago)
Topics: 8
Reputation: 170
Has thanked: 77 times
Been thanked: 232 times

Compiling for Android

Post by angel44e »

Hi,Archie! Could you explain how to compile OEX android engines with Android Studio like your first post in that topic,please?
angel44e
Forum Contributions
Points: 11 227,00 
Posts: 135
Joined: 19/04/2023, 16:17
Status: Offline (Active 2 Weeks, 4 Days, 7 Hours, 24 Minutes ago)
Topics: 8
Reputation: 170
Has thanked: 77 times
Been thanked: 232 times

Compiling for Android

Post by angel44e »

When I've compiled an engine by clang and it was compiled successfully(without any errors and warnings) it's failed to started in Droidfish in most cases.But when I've compiled the same engine by ndk there is no problem with it,what caused this?
Archimedes

Android Engines Top Active Users
Forum Contributions
Points: 42 582,00 
Posts: 2059
Joined: 04/11/2019, 21:13
Status: Offline (Active 4 Hours, 17 Minutes ago)
Medals: 2
Topics: 158
Reputation: 7111
Been thanked: 6477 times

Compiling for Android

Post by Archimedes »

You compiled under Termux? Does the chess engine work there?
Maybe -static-libstdc++ is missing. Another cause could be the wrong API level.
angel44e
Forum Contributions
Points: 11 227,00 
Posts: 135
Joined: 19/04/2023, 16:17
Status: Offline (Active 2 Weeks, 4 Days, 7 Hours, 24 Minutes ago)
Topics: 8
Reputation: 170
Has thanked: 77 times
Been thanked: 232 times

Compiling for Android

Post by angel44e »

Yes,Archie,I've compiled under Termux.How to check if the engine is working in Termux? I've installed Termux,then I've downloaded ndk,and then started your cecsa.sh to install all needed tools and I think it successfully done.And how to add -static-libstdc++ if missing?
angel44e
Forum Contributions
Points: 11 227,00 
Posts: 135
Joined: 19/04/2023, 16:17
Status: Offline (Active 2 Weeks, 4 Days, 7 Hours, 24 Minutes ago)
Topics: 8
Reputation: 170
Has thanked: 77 times
Been thanked: 232 times

Compiling for Android

Post by angel44e »

I've been running Android 11 API 30 if it depends.
kramnik

Top contribute Forum
Forum Contributions
Points: 40 305,00 
Posts: 1924
Joined: 04/11/2019, 14:45
Status: Offline (Active 3 Months, 6 Days, 17 Hours, 49 Minutes ago)
Medals: 1
Topics: 71
Reputation: 2388
Location: North-Italy
Has thanked: 1185 times
Been thanked: 2951 times

Compiling for Android

Post by kramnik »

Archimedes: this vital page should be added to your Wiki Home:

https://sourceforge.net/p/chess-engines-for-android-oex/wiki/how-to-create-an-apk-file-for-texel/

The attached Texel project is fundamental as base to create new APKs.
Archimedes wrote: 01/02/2023, 9:43
kramnik wrote: 31/01/2023, 22:33 Still, I see no tutorials about how to compile the Stockfish source into OEX (APK installer). With the newest Android releases there is a restriction which many chess apps adopted, so one cannot just compile the source to binary and use it to said apps anymore.
There is already a ready-made and documented Java library that can do this. You don't have to reinvent the wheel.

https://github.com/gkalab/chessenginesupport-androidlib

To see how it works, there is also an example for Stockfish.

Another example can be found here:
https://github.com/peterosterlund2/texelapp

And yet another example, adapted to a newer version of Android Studio, can be found here:
https://sourceforge.net/p/chess-engines-for-android-oex/wiki/home/
angel44e
Forum Contributions
Points: 11 227,00 
Posts: 135
Joined: 19/04/2023, 16:17
Status: Offline (Active 2 Weeks, 4 Days, 7 Hours, 24 Minutes ago)
Topics: 8
Reputation: 170
Has thanked: 77 times
Been thanked: 232 times

Compiling for Android

Post by angel44e »

Hi,Archie! How to compile for Android an engine with mostly header(.h) files in the source code, for example Clover 5.0?
Archimedes

Android Engines Top Active Users
Forum Contributions
Points: 42 582,00 
Posts: 2059
Joined: 04/11/2019, 21:13
Status: Offline (Active 4 Hours, 17 Minutes ago)
Medals: 2
Topics: 158
Reputation: 7111
Been thanked: 6477 times

Compiling for Android

Post by Archimedes »

angel44e wrote: 25/06/2023, 7:40 Hi,Archie! How to compile for Android an engine with mostly header(.h) files in the source code, for example Clover 5.0?
As long as the source code is not just header files, there is hope (see main.cpp in the src directory). A look at the makefile of Clover would answer your question.
superbatil
Forum Contributions
Points: 14 010,00 
Posts: 76
Joined: 24/02/2022, 11:23
Status: Offline (Active 2 Weeks, 5 Hours, 25 Minutes ago)
Topics: 0
Reputation: 17
Has thanked: 1 time
Been thanked: 51 times

Compiling for Android

Post by superbatil »

I can not see it in /usr/bin/ on termux

Code: Select all

aarch64-linux-android21-clang++

Code: Select all

/data/data/com.termux/files/usr/bin
this is available, instead of (aarch64-linux-android21-clang
aarch64-linux-android21-clang++)

Code: Select all

aarch64-linux-android-ar
 aarch64-linux-android-clang
 aarch64-linux-android-clang++
 aarch64-linux-android-cpp
 aarch64-linux-android-g++
 aarch64-linux-android-gcc
 aarch64-linux-android-ld
 aarch64-linux-android-nm
 aarch64-linux-android-objdump
 aarch64-linux-android-ranlib
 aarch64-linux-android-readelf
 aarch64-linux-android-strip
Archimedes

Android Engines Top Active Users
Forum Contributions
Points: 42 582,00 
Posts: 2059
Joined: 04/11/2019, 21:13
Status: Offline (Active 4 Hours, 17 Minutes ago)
Medals: 2
Topics: 158
Reputation: 7111
Been thanked: 6477 times

Compiling for Android

Post by Archimedes »

superbatil wrote: 18/07/2023, 19:07 I can not see it in /usr/bin/ on termux

Code: Select all

aarch64-linux-android21-clang++

Code: Select all

/data/data/com.termux/files/usr/bin
this is available, instead of (aarch64-linux-android21-clang
aarch64-linux-android21-clang++)

Code: Select all

aarch64-linux-android-ar
 aarch64-linux-android-clang
 aarch64-linux-android-clang++
 aarch64-linux-android-cpp
 aarch64-linux-android-g++
 aarch64-linux-android-gcc
 aarch64-linux-android-ld
 aarch64-linux-android-nm
 aarch64-linux-android-objdump
 aarch64-linux-android-ranlib
 aarch64-linux-android-readelf
 aarch64-linux-android-strip
May I ask what you are actually looking for?
Post Reply

Return to “Programming, Technical Discussions, Chess related questions etc.”