Menu

HOWTO

Mark Heily

OpenGCD/Android HOWTO

In order to build OpenGCD for Android, you need to follow these basic steps:
* Download the OpenGCD source code
* Install the SDK and NDK for Android
* Install Eclipse
* Install the ADT Plugin for Eclipse
* Install the Android platform components
* Create a Android Virtual Device (AVD)
* Build OpenGCD

The detailed instructions are below.

Download OpenGCD

Checkout a working copy of the source code with this command:


svn checkout svn://svn.code.sf.net/p/opengcd/code/trunk opengcd

Android SDK

Download and install the Android SDK from here:

http://developer.android.com/sdk/index.html

Android NDK

In order to build native C/C++ libraries to run on Android, you will need the NDK. Download and install it from here:

http://developer.android.com/tools/sdk/ndk/index.html

Clang

OpenGCD requires clang, so for this we are going to build a custom version of clang that targets the ARM/Android platform. Run this command to download and build clang:

make clang

This will work on Linux, but fail to build on Mac OS X due to bug 13478. Even though it fails to complete the build, it will build the 'clang' binary which is all you really need to build OpenGCD.

After building clang, copy it into the Android toolchain directory.

# Modify this to point at wherever you downloaded the NDK
TOOLCHAIN=$HOME/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 

cp Debug+Asserts/bin/clang $TOOLCHAIN/bin
cp -r Debug+Asserts/lib/clang $TOOLCHAIN/lib
ln -sf clang $TOOLCHAIN/bin/arm-linux-androideabi-gcc
ln -sf clang $TOOLCHAIN/bin/arm-linux-androideabi-g++

Eclipse

  • Install Eclipse and the ADT plugin for Eclipse.

    Instructions:
    http://developer.android.com/sdk/installing/installing-adt.html

  • Start the Eclipse IDE

  • In the top menu of Eclipse, click on Window -> Android SDK Manager
  • Install all of the available components under "Android 4.0.3 (API 15)"
  • Close the Android SDK Manager window
  • In the top menu of Eclipse, click on Window -> AVD Manager
  • Click the New button to create a new virtual Android device.
  • Give it a name
  • In the "Target" field, select "Android 4.0.3 - API Level 15"
  • In the "CPU/ABI" field, select "ARM (armeabi-v7a)"
  • Click on 'Create AVD'
  • Close the AVD Manager window

OpenGCD

Now you can build OpenGCD and run the unit tests on the Android emulator.

  1. Checkout the source code.

    svn co svn://svn.code.sf.net/p/opengcd/code/trunk opengcd
    cd opengcd
  2. Edit the Makefile and set the NDK variable to point to the top-level of where you installed the NDK. Example:

    NDK := /home/johnsmith/android-ndk-r8
  3. Build it.

    make
  4. Start the Android virtual device via Eclipse.

    Window -> AVD Manager -> Start
  5. Run the OpenGCD unit tests in the emulator.

    make check

Related

Wiki: Android