How to compile Boost 1.61 for Android NDK 11

I want to install Boost 1.61 compilation with clang 3.6 for Android with NDK 11, but this software: https://github.com/moritz-wundke/Boost-for-Android does not update and does not support these versions.

I want to know if anyone succeeded!

Thanks!

+6
source share
3 answers

It worked for me

  • I created clang Standalone Toolchain https://developer.android.com/ndk/guides/standalone_toolchain.html
  • I set PATH to PATH=/your/path/ndk/toolchain/bin
  • Run ./bootstrap.sh --with-toolset=clang
  • ./b2 toolset=clang cxxflags="-stdlib=libc++" threading=multi threadapi=pthread link=shared runtime-link=shared -j 6
  • I linked this to my project

I looked at these pages

Compiling and using boost for Android NDK R10e

http://nolimitsdesigns.com/game-design/how-to-build-boost-for-the-android-ndk-llvm/

+3
source

Create boost_1_62_0 for Android-21 under Windows64.

Assuming the NDK is installed on C:\Programs\Android\sdk\ndk-bundle and c:\boost_1_62_0 .

Install mingw: using msys2-x86_64 from MSYS2

Install the build tools from the mingw prompt (something like this):

 $ pacman -S gcc binutils 

Create the android.clang.jam file in C:\boost_1_62_0\ with the following text content:

 import os ; local AndroidNDKRoot = C:/Programs/Android/sdk/ndk-bundle ; using clang : android : C:/Programs/Android/toolchain21/bin/clang++ : <compileflags>-fexceptions <compileflags>-frtti <compileflags>-fpic <compileflags>-ffunction-sections <compileflags>-funwind-tables <compileflags>-Wno-psabi <compileflags>-march=armv7-a <compileflags>-mfloat-abi=softfp <compileflags>-mfpu=vfpv3-d16 <compileflags>-fomit-frame-pointer <compileflags>-fno-strict-aliasing <compileflags>-finline-limit=64 <compileflags>-I$(AndroidNDKRoot)/platforms/android-21/arch-arm/usr/include <compileflags>-Wa,--noexecstack <compileflags>-DANDROID <compileflags>-D__ANDROID__ <compileflags>-DNDEBUG <compileflags>-O2 #<compileflags>-g <compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include <compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include <architecture>arm <compileflags>-fvisibility=hidden <compileflags>-fvisibility-inlines-hidden <compileflags>-fdata-sections <cxxflags>-D__arm__ <cxxflags>-D_REENTRANT <cxxflags>-D_GLIBCXX__PTHREADS ; 

Speeding up settings from the mingw prompt:

 $ export NDK=/c/Programs/Android/sdk/ndk-bundle $ echo ensure msi-installed Python is on path (not msys version): $ export PATH=/c/Python27:$PATH $ $NDK/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir /c/Programs/Android/toolchain21 $ ./bootstrap.sh --with-toolset=gcc $ ./b2 --user-config=android.clang.jam threading=multi link=static \ runtime-link=static toolset=clang-android target-os=linux \ threadapi=pthread --stagedir=android --with-chrono \ --with-program_options --with-system --with-thread --with-random \ --with-regex 
+3
source

Yes, the repository you mentioned is apparently no longer supported. The author also does not seem to be responding to any letters on this subject. If you look, you will see that each new supporting version supported a lot of work there (many special flags in the configuration files). This is apparently why he does not have time to maintain it. I also tried upgrading to 1.64 using a fork, but gave up countless error messages and instead used another method based on a crystal script. Its simple and should work for almost any version. Here you can find the details and the script (simple and painless): http://silverglint.com/boost-for-android/ Works with clang and gcc.

An example application is also included that shows how to use embedded binaries.

0
source

All Articles