The Android NDK is no longer dependent on Cygwin, so you can create Boost using the NDK from the Windows command line ( cmd ).
To make Boost.Build find the NDK, edit the boost\tools\build\v2\user-config.jam and add the following text:
import os ; androidNDKRoot = C:/android-ndk-r8e ; # put the relevant path using gcc : android : $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ : <compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm <compileflags>-mthumb <compileflags>-Os <compileflags>-fno-strict-aliasing <compileflags>-O2 <compileflags>-DNDEBUG <compileflags>-g <compileflags>-lstdc++ <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/include <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include <compileflags>-D__GLIBC__ <compileflags>-D_GLIBCXX__PTHREADS <compileflags>-D__arm__ <compileflags>-D_REENTRANT <archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ar <ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ranlib ;
Of course, instead of c:/android-ndk-r8e you should put the correct NDK location on your computer.
Alternatively, you can choose a later platform API, rather than android-9 .
Also note that the NDK supplies several tool chains, and the above settings point to gcc-4.7. If you prefer to build boost with some other arm-linux-androideabi-4.7 , change arm-linux-androideabi-4.7 to the appropriate path.
After you set the configuration in user-config.jam, open cmd , cd in the directory where Boost is located and call bootstrap . Then call b2 like this (for example):
b2 --without-python --without-serialization threading=multi link=static runtime-link=static toolset=gcc-android target-os=linux threadapi=pthread --stagedir=android stage
UPDATE . As of 11/2015, older NDK toolkits seem to have problems with newer versions of Boost, which causes the compiler to crash, so consider using a more compiler. To do this, simply change each occurrence 4.7 in the above script to 4.9. In addition, it is worth compiling a later Android API (for example, andoroid-9 -> andoroid-16 or so).
Igor R.
source share