how to compile for Android

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

how to compile for Android

Post by PK »

Hi,

What should I do to compile Rodent (or any other console application chess program) for Android?

I am using Windows and Visual Studio 2017 community edition. Theoretically it should compile C++ code for ARM, but in practice I get a warning that I cannot compile a classic application for platform {0}

Any hints?
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: how to compile for Android

Post by Sesse »

As far as I know, you cannot use Visual Studio for this. Android runs Linux; Visual Studio is Windows-only. You want the Android Native Development kit (and ideally a Linux machine—although the NDK can cross-compile, it's unlikely that the build system for any given engine will support that).

No matter what, be prepared to do a some porting work.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: how to compile for Android

Post by PK »

Theoretically, compiling under Windows for Android should be possible. The warning I mentioned can be solved by changing vcproject file (see https://pete.akeo.ie/2017/05/compiling- ... -with.html caveat #2), now I get a linker error about the wrong machine (LNK 1112).
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: how to compile for Android

Post by syzygy »

PK wrote: Mon Jul 23, 2018 7:31 pm Theoretically, compiling under Windows for Android should be possible. The warning I mentioned can be solved by changing vcproject file (see https://pete.akeo.ie/2017/05/compiling- ... -with.html caveat #2), now I get a linker error about the wrong machine (LNK 1112).
Compiling for ARM (= a processor architecture) is not the same as compiling for Android (= a version of Linux that runs on ARM).

In particular, I'm quite sure that Windows RT binaries and Windows 10 on ARM binaries won't run on Android.
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: how to compile for Android

Post by Ras »

You can cross-compile under Windows using the NDK: https://developer.android.com/ndk/guide ... _toolchain

However, there are additional issues with C++ where you have a lot of STLs to choose from (I would expect most of the options not to work). On top of that, it looks like Rodent is using CPU dependent code with SSE3, which will probably give another rounds of headache. And stuff like wordexp.h which NDK doesn't find, or at least my installation fails to do so.
Rasmus Althoff
https://www.ct800.net
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: how to compile for Android

Post by syzygy »

Apparently Wine includes some support for ARM:
https://wiki.winehq.org/ARM

But I have little doubt that trying to get an ARM Windows binary to work on Android using Wine is a much greater headache than rewriting the engine to be portable.
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: how to compile for Android

Post by Ras »

syzygy wrote: Mon Jul 23, 2018 9:35 pmrewriting the engine to be portable.
Especially since that seems already to be the case with Rodent where the website says (under downloads) "source code ready to be compiled under Linux".
Rasmus Althoff
https://www.ct800.net
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: how to compile for Android

Post by Sesse »

Presumably that's Linux/glibc, not Linux/Bionic, but yes, trying to make a Windows ARM binary and getting it to run on Android is a losing game here.