Created
October 4, 2012 20:58
-
-
Save deltheil/3836406 to your computer and use it in GitHub Desktop.
Android NDK advanced example: build msgpack w/ the Standalone Toolchain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export NDK=/tmp/android-ndk-r8b | |
# 1. Use the tools from the Standalone Toolchain | |
export PATH=/tmp/my-android-toolchain/bin:$PATH | |
export SYSROOT=/tmp/my-android-toolchain/sysroot | |
export CC="arm-linux-androideabi-gcc --sysroot $SYSROOT" | |
export CXX="arm-linux-androideabi-g++ --sysroot $SYSROOT" | |
export CXXSTL=$NDK/sources/cxx-stl/gnu-libstdc++/4.6 | |
# 2. Clone the Github repo and run the bootstrap actions | |
git clone git://github.com/msgpack/msgpack.git; cd msgpack/cpp | |
./preprocess | |
./bootstrap | |
mkdir build | |
# 3. Run the configure to target a static library for the ARMv7 ABI | |
./configure --prefix=$(pwd)/build \ | |
--host=arm-linux-androideabi \ | |
--disable-shared \ | |
CFLAGS="-march=armv7-a" \ | |
CXXFLAGS="-march=armv7-a -I$CXXSTL/include -I$CXXSTL/libs/armeabi-v7a/include" | |
# 4. Build | |
make && make install | |
# 5. Inspect the library architecture specific information | |
arm-linux-androideabi-readelf -A build/lib/libmsgpack.a | |
# File: lib/lib/libmsgpack.a(unpack.o) | |
# Attribute Section: aeabi | |
# File Attributes | |
# Tag_CPU_name: "7-A" | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment