android - 如何为 Android NDK 11 编译 Boost 1.61

标签 android c++ boost

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

我想知道是否有人做到了!

谢谢!

最佳答案

在 Windows64 下为 Android-21 构建 boost_1_62_0。

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

安装 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 提示设置 boost :

$ 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

关于android - 如何为 Android NDK 11 编译 Boost 1.61,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37679587/

相关文章:

android - Android中最快的移动物体识别和跟踪

android - 在Android中以圆形布局动态添加imageViews

Android - WLAN 和 3G 连接之间的差异

java - Android 拥有多个 View 的最有效方式

c++ - 从成员函数创建线程时出现段错误(核心转储)错误

c++ - 构造函数的初始化列表

c++ - 我可以滥用谓词在 remove_if 删除元素之前对元素执行操作吗?

c++ - 当我更改 g++ 参数的顺序时,为什么我的程序无法链接?

python - asio 无法将消息写入服务器两次以上

c++ - boost spirit x3 : parse into structs