Steps for building and testing NDK

From Dmz-portal

Jump to: navigation, search
 # 1. Get two directories from googlesource
 export MYTMP=/tmp
 cd $MYTMP
 git clone
 git clone
 # 2. Download toolchain source
 export NDK=$MYTMP/ndk
 $NDK/build/tools/ $MYTMP/src
 # 3. Build arm, x86 and mips NDK toolchains
 cd $NDK
 $NDK/build/tools/ --systems=linux-x86 --package-dir=$MYTMP/package $MYTMP/src
 $NDK/build/tools/ --systems=linux-x86 --out-dir=$MYTMP/out --prebuilt-dir=$MYTMP/package
 # 4. Test arm, x86 and mips
 # For running code on real devices, we need to connect a device to a usb port.
 # The adb command is in android-sdk-linux that can be downloaded from
 adb kill-server
 sudo adb start-server
 adb devices
 cd $NDK/tests
 ./ --abi=armeabi
 ./ --abi=armeabi-v7a
 ./ --abi=x86
 ./ --abi=mips
 # 5. The current NDK build is for 4.4.3.  We need to build 4.6 toolchains explicitly.
 cd $NDK
 $NDK/build/tools/ $MYTMP/src $NDK arm-linux-androideabi-4.6 --build-out=$MYTMP/arm-out --sysroot=$NDK/platforms/android-9/arch-arm --package-dir=$MYTMP/package
 $NDK/build/tools/ $MYTMP/src $NDK x86-4.6 --build-out=$MYTMP/x86-out --sysroot=$NDK/platforms/android-9/arch-x86 --package-dir=$MYTMP/package
 $NDK/build/tools/ $MYTMP/src $NDK mipsel-linux-android-4.6 --build-out=$MYTMP/mips-out --sysroot=$NDK/platforms/android-9/arch-mips --package-dir=$MYTMP/package
 # Copy *.mk *.x *.xsc files to new toolchains
 cp toolchains/arm-linux-androideabi-4.4.3/*.* toolchains/arm-linux-androideabi-4.6/
 cp toolchains/x86-4.4.3/*.* toolchains/x86-4.6/
 cp toolchains/mipsel-linux-android-4.4.3/*.* toolchains/mipsel-linux-android-4.6/
 # 6. Test arm, x86 and mips again with 4.6 toolchains
 # Scripts will pick up 4.6 toolchains automatically.
 cd $NDK/tests
 ./ --abi=armeabi
 ./ --abi=armeabi-v7a
 ./ --abi=x86
 ./ --abi=mips
Personal tools