Personal tools
The Open Lighting Project has moved!

We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.

Difference between revisions of "OLA on Android"

From wiki.openlighting.org

Jump to: navigation, search
m (OLA)
m (OLA)
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
These are my notes from trying to get OLA working on Android.
+
These are my notes from trying to get OLA working on Android. This work was done on a Mac, but it should be the same on Linux with a few minor tweaks.
  
 
== Toolchain ==
 
== Toolchain ==
  
Download the ndk. Extract.
+
Download the [http://developer.android.com/tools/sdk/ndk/index.html Android NDK].
 +
Extract, this assumes you extracted to $HOME/android-ndk-XXX.
  
~/android-ndk-r8c/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=$HOME/android-ndk-r8c/standalone-toolchain-api9
+
The NDK comes with a script to build a stand alone toolchain. We need to run it.
  
 +
<pre>
 +
$ cd android-ndk-XXX
 +
$ ./build/tools/make-standalone-toolchain.sh --system=darwin-x86_64 --platform=android-9 --install-dir=$HOME/android-toolchain/api9
 +
</pre>
  
 +
== Setup ==
 +
 +
We'll do all the work in $HOME/android
 +
 +
<pre>
 +
$ mkdir $HOME/android
 +
# where we install libs to
 +
$ mkdir $HOME/android/root
 +
</pre>
 +
 +
Setup env variables. Make sure you adjust the first line to use the version you downloaded.
 +
 +
<pre>
 +
$ export ANDROID_NDK_PATH=$HOME/android-ndk-XXX
 +
$ export ANDROID_PLATFORM=9
 +
$ export ANDROID_NDK_STANDALONE_TOOLCHAIN=~/android-toolchain/api$ANDROID_PLATFORM
 +
$ export CPPFLAGS=""
 +
$ export LDFLAGS=""
 +
$ export PATH=$ANDROID_NDK_PATH/android-sdk-linux_x86/tools:$ANDROID_NDK_PATH/android-sdk-linux_x86/platform-tools:$ANDROID_NDK_STANDALONE_TOOLCHAIN/bin:$PATH
 +
</pre>
 +
 +
Test it out:
 +
 +
<pre>
 +
$ ls $ANDROID_NDK_PATH
 +
$ ls $ANDROID_NDK_STANDALONE_TOOLCHAIN
 +
</pre>
  
 
== Protobuf ==
 
== Protobuf ==
  
Download libprotobuf & extract.
+
You need to have protoc installed on your system first. It *must* be the same version that you build for android. To find out the correct path, run:
  
 
<pre>
 
<pre>
./configure  --host=arm-linux-androideabi  CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-c++ --with-protoc=/opt/local/bin/protoc
+
$ which protoc
make
+
/usr/local/bin/protoc
 +
$ protoc --version
 +
libprotoc 2.5.0
 
</pre>
 
</pre>
  
TODO: install into sysroot. Figure out how to package (or should we statically link to ola?)
+
Then pass this path shown in the --with-protoc argument below.
 +
 
 +
Note: if you get an error like <tt>Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized</tt> when running ./configure, you need to get new versions of config.sub and config.guess and replace the ones in each package. The latest can be downloaded from http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree
 +
 
 +
You should also copy config.sub and config.guess to gtest/build-aux.
 +
 
 +
 
 +
<pre>
 +
$ cd $HOME/android
 +
$ wget <protobuf>
 +
$ tar -zxf <protobuf>
 +
$ cd protobuf-X.Y.Z
 +
# fetch config.sub and config.guess if needed
 +
$ ./configure  --host=arm-linux-androideabi  --with-protoc=/opt/local/bin/protoc
 +
$ make
 +
$ DESTDIR="$HOME/android/root" make install
 +
</pre>
 +
 
 +
 
 +
TODO: Figure out how to package (or should we statically link to ola?)
 +
 
 +
== UUID ==
 +
 
 +
OSSP UUID is quite old (2008) now so it doesn't cross compile well. Instead we'll use the libuuid from e2fsprogs.
 +
 
 +
Download from http://e2fsprogs.sourceforge.net/
 +
 
 +
<pre>
 +
$ cd $HOME/android
 +
$ wget <e2fsprogs-url>
 +
$ tar -zxf <e2fsprogs>
 +
$ cd e2fsprogs-X.Y.Z
 +
$ ./configure  --host=arm-linux-androideabi --prefix=/usr/local
 +
# we only want the libuuid bit
 +
$ cd lib/uuid
 +
$ make
 +
$ DESTDIR="$HOME/android/root make install
 +
</pre>
 +
 
 +
== Dependency Check ==
 +
 
 +
By this point you should have protobuf and uuid installed into ~/android/root. Check this is so:
 +
 
 +
<pre>
 +
$ ls ~/android/root/usr/local/include/
 +
google uuid
 +
$ ls ~/android/root/usr/local/lib/pkgconfig/
 +
protobuf-lite.pc protobuf.pc      uuid.pc
 +
$ export PKG_CONFIG_PATH="$HOME/android/root/usr/local/lib/pkgconfig"
 +
$ export PKG_CONFIG_SYSROOT_DIR="$HOME/android/root"
 +
$ pkg-config --list-all | grep uuid
 +
uuid        uuid - Universally unique id library
 +
$ pkg-config --cflags uuid
 +
-I/Users/simonn/android/root/usr/local/include/uuid
 +
</pre>
  
 
== OLA ==
 
== OLA ==
Line 24: Line 112:
 
<pre>
 
<pre>
 
export ac_cv_func_malloc_0_nonnull=yes
 
export ac_cv_func_malloc_0_nonnull=yes
./configure --host=arm-linux-androideabi --build=i686-pc-linux-gnu CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-c++
+
./configure --host=arm-linux-androideabi --disable-http --disable-unittests  --disable-libftdi  --disable-spi --disable-osc
 
make
 
make
 
</pre>
 
</pre>

Latest revision as of 21:34, 21 May 2013

These are my notes from trying to get OLA working on Android. This work was done on a Mac, but it should be the same on Linux with a few minor tweaks.

Toolchain

Download the Android NDK. Extract, this assumes you extracted to $HOME/android-ndk-XXX.

The NDK comes with a script to build a stand alone toolchain. We need to run it.

$ cd android-ndk-XXX
$ ./build/tools/make-standalone-toolchain.sh --system=darwin-x86_64 --platform=android-9 --install-dir=$HOME/android-toolchain/api9

Setup

We'll do all the work in $HOME/android

$ mkdir $HOME/android
# where we install libs to
$ mkdir $HOME/android/root

Setup env variables. Make sure you adjust the first line to use the version you downloaded.

$ export ANDROID_NDK_PATH=$HOME/android-ndk-XXX
$ export ANDROID_PLATFORM=9
$ export ANDROID_NDK_STANDALONE_TOOLCHAIN=~/android-toolchain/api$ANDROID_PLATFORM
$ export CPPFLAGS=""
$ export LDFLAGS=""
$ export PATH=$ANDROID_NDK_PATH/android-sdk-linux_x86/tools:$ANDROID_NDK_PATH/android-sdk-linux_x86/platform-tools:$ANDROID_NDK_STANDALONE_TOOLCHAIN/bin:$PATH

Test it out:

$ ls $ANDROID_NDK_PATH
$ ls $ANDROID_NDK_STANDALONE_TOOLCHAIN

Protobuf

You need to have protoc installed on your system first. It *must* be the same version that you build for android. To find out the correct path, run:

$ which protoc
/usr/local/bin/protoc
$ protoc --version
libprotoc 2.5.0

Then pass this path shown in the --with-protoc argument below.

Note: if you get an error like Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized when running ./configure, you need to get new versions of config.sub and config.guess and replace the ones in each package. The latest can be downloaded from http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree

You should also copy config.sub and config.guess to gtest/build-aux.


$ cd $HOME/android
$ wget <protobuf>
$ tar -zxf <protobuf>
$ cd protobuf-X.Y.Z
# fetch config.sub and config.guess if needed
$ ./configure   --host=arm-linux-androideabi  --with-protoc=/opt/local/bin/protoc
$ make
$ DESTDIR="$HOME/android/root" make install


TODO: Figure out how to package (or should we statically link to ola?)

UUID

OSSP UUID is quite old (2008) now so it doesn't cross compile well. Instead we'll use the libuuid from e2fsprogs.

Download from http://e2fsprogs.sourceforge.net/

$ cd $HOME/android
$ wget <e2fsprogs-url>
$ tar -zxf <e2fsprogs>
$ cd e2fsprogs-X.Y.Z
$ ./configure   --host=arm-linux-androideabi --prefix=/usr/local
# we only want the libuuid bit
$ cd lib/uuid
$ make
$ DESTDIR="$HOME/android/root make install

Dependency Check

By this point you should have protobuf and uuid installed into ~/android/root. Check this is so:

$ ls ~/android/root/usr/local/include/
google uuid
$ ls ~/android/root/usr/local/lib/pkgconfig/
protobuf-lite.pc protobuf.pc      uuid.pc
$ export PKG_CONFIG_PATH="$HOME/android/root/usr/local/lib/pkgconfig"
$ export PKG_CONFIG_SYSROOT_DIR="$HOME/android/root"
$ pkg-config --list-all | grep uuid
uuid        uuid - Universally unique id library
$ pkg-config --cflags uuid
-I/Users/simonn/android/root/usr/local/include/uuid 

OLA

export ac_cv_func_malloc_0_nonnull=yes
./configure --host=arm-linux-androideabi  --disable-http --disable-unittests  --disable-libftdi  --disable-spi --disable-osc
make