Skip to content

Instantly share code, notes, and snippets.

@deltheil
Created October 4, 2012 20:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deltheil/3836196 to your computer and use it in GitHub Desktop.
Save deltheil/3836196 to your computer and use it in GitHub Desktop.
Android NDK basic example: build jsmn C parser w/ the Standalone Toolchain
# 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 AR=arm-linux-androideabi-ar
# 2. Clone the Github mirror
git clone git://github.com/noct/jsmn.git; cd jsmn
# 3. Build for the ARMv7 ABI
# -> this creates libjsmn.a static library
make CFLAGS="-march=armv7-a"
# 4. Inspect the library architecture specific information
arm-linux-androideabi-readelf -A libjsmn.a
# File: libjsmn.a(jsmn.o)
# Attribute Section: aeabi
# File Attributes
# Tag_CPU_name: "7-A"
# Tag_CPU_arch: v7
# Tag_CPU_arch_profile: Application
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment