如何为Android NDK 11编译Boost 1.61

时间:2016-06-07 12:36:30

标签: android c++ boost

我想安装编译Boost 1.61和clang 3.6 for android和NDK 11但是这个软件:https://github.com/moritz-wundke/Boost-for-Android没有更新,也不支持这个版本。

我想知道是否有人设法做到这一点!

谢谢!

2 个答案:

答案 0 :(得分:3)

对我来说,这是

  1. 我创建了一个clang Standalone Toolchain https://developer.android.com/ndk/guides/standalone_toolchain.html
  2. 我将PATH设置为PATH=/your/path/ndk/toolchain/bin
  3. 运行./bootstrap.sh --with-toolset=clang
  4. ./b2 toolset=clang cxxflags="-stdlib=libc++" threading=multi threadapi=pthread link=shared runtime-link=shared -j 6
  5. 我用我的项目
  6. 链接了它

    我看过这些页面

    Compile and use boost for Android NDK R10e

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

答案 1 :(得分:3)

在Windows64下为Android-21构建boost_1_62_0。

假设NDK已安装到C:\Programs\Android\sdk\ndk-bundle并在c:\boost_1_62_0中增加。

安装mingw:using msys2-x86_64 from MSYS2

从mingw提示符安装构建工具(类似这样):

$ pacman -S gcc binutils

使用此类文本内容在C:\boost_1_62_0\中创建android.clang.jam文件:

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
;

从mingw提示设置提升:

$ 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