Porting to android

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Porting to android

Post by Kempelen »

What is needed to port an engine to Android plataform under "Android chess"? is needed to port it to java or are there any shortcut?
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Porting to android

Post by Michel »

Kempelen wrote:What is needed to port an engine to Android plataform under "Android chess"? is needed to port it to java or are there any shortcut?
Nothing is needed! Just compile the engine with an ARM toolchain. There are two options.

(1) Download the CodeSourcery toolchain (eabi-linux) and create a static binary.

(2) Download the Google NDK and use it to create an Android native toolchain (the instructions are in the documentation folder). Now you can create a dynamically linked binary.

Since engines are typically small executables that do not have a large dependence on external libraries I personally think (2) is not worth the extra trouble.
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Porting to android

Post by abik »

In a nutshell, programmers currently have the following options:
  • Download the Android SDK, and develop both the GUI and engine in Java (and only rely on the JIT for a speed boost).
  • Download the Android SDK and NDK, and write parts in Java (typically the GUI) and embed natively compiled components (typically the engine), which are called through JNI.
  • Use an ARM compiler (as ships with the NDK) to compile an engine into a native binary and "import" the engine into a GUI that supports its chess protocol.
To my knowledge, only Chess for Android (http://www.aartbik.com/MISC/uchess.html) supports option (3) for third party UCI engines, but other GUIs and/or procotols may soon become available. In my experience, if an engine already has been ported to Linux or MacOS, no or almost no porting is required to compile the engine for Android. Engines that are exclusively compiled for Windows may pose some challenges. As a final note, although Android platforms are now mainly ARMv5TE, x86 platforms are emerging, so things will remain interesting for a while....