Build boost for Android

Run script buildboostandroid

Run the bash script named buildboostandroid in ~/bin. E.g.


buildboostandroid 64

This creates a folder ~/boost, downloads and unzips a tarball file for the boost libraries. [todo: make it do the additional steps below]

boost
  ├── boost_1_64_0
  └── boost_1_64_0.tar.bz2

github project to build boost on Android

The Boost for Android project on GitHub builds the Boost C++ Libraries for the Android platform, with Google's Ndk. Tested with Boost 1.64 and Google's Ndk 15b (current versions as of June 2017)

Click on the button 'Clone or download' to download the zip file, extract the folder Boost-for-Android-master to be under the ~/boost folder.

There are two files which need to be edited, doit.sh and build-boost.sh:

boost
  └── Boost-for-Android-master
      ├── doit.sh
      └── build_tools
          └── build-boost.sh

Changes to build-boost.sh

There was a problem building some of the boost libraries, so various --without--xxx switches were passed to b2 in build-boost.sh (to only build libaries atomic, chrono, filesystem, system and thread):


    run ./b2 -d+2 -q -j$NUM_JOBS \
        --without-mpi \
        --without-serialization \
        --without-container \
        --without-context \
        --without-coroutine \
        --without-coroutine2 \
        --without-date_time \
        --without-exception \
        --without-graph \
        --without-graph_parallel \
        --without-iostreams \
        --without-locale \
        --without-log \
        --without-math \
        --without-program_options \
        --without-random \
        --without-regex \
        --without-signals \
        --without-test \
        --without-timer \
        --without-type_erasure \
        --without-wave \
        variant=release \
        link=$LIB_LINKAGE \
        runtime-link=shared \
        threading=multi \
        target-os=android \
        binary-format=elf \
        address-model=$BJAMADDRMODEL \
        architecture=$BJAMARCH \
        abi=$BJAMABI \
        --user-config=user-config.jam \
        --layout=system \
        --prefix=$PREFIX \
        --build-dir=$BUILDDIR/build \
        $WITHOUT \
        install \

Edit the bash script named ~/boost/Boost-for-Android-master/build_tools/build-boost.sh

Output of building boost

Boost 1.60.0 libraries for platforms arm64-v8a, armeabi-v7a and x86 were installed into into ~/boost/Boost-for-Android-master/build/boost/1.60.0


    ~/boost/Boost-for-Android-master/build
    └── boost
        └── 1.60.0
            ├── Android.mk
            ├── include
            │   └── boost
            ├── libs
            │   ├── arm64-v8a
            │   │   ├── gnu-4.9
            │   │   └── llvm-3.5
            │   ├── armeabi-v7a
            │   │   ├── gnu-4.9
            │   │   └── llvm-3.5
            │   └── x86
            │       ├── gnu-4.9
            │       └── llvm-3.5
            └── LICENSE_1_0.txt