windows下编译Android版本的boost库文件
1.起因:
手上有一个用到了boost的asio库和thread库的工程要编译到手机上(Android版本和ios版本),本文只介绍如何编译到Android版本,ios版本之后再介绍,也许就不介绍了(注:因为mac下官方有教程如何编译)
2.准备工作
2.1 下载boost库,我这里用到的是1.58.0
2.2 下载NDK(注:Google官方地址,需要翻墙),根据情况自己选择下载版本,我这里用的是android-ndk-r10d-windows-x86_64.exe
2.3 安装visual studio 2012或者2013, 我用的是vs2013
3.开始编译
3.1 解压boost压缩文件
3.2 在命令行下进入上步文件夹下,然后运行bootstrap.bat,这里会生成project-config.jam文件
3.3 修改project-config.jam文件,修改内容如下
import option ;
androidNDKRoot = E:/android/android-ndk-r10d ; # put the relevant path
using gcc : android
:
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++
:
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar
<compileflags>-fexceptions
<compileflags>-frtti
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-D__ARM_ARCH_5__
<compileflags>-D__ARM_ARCH_5T__
<compileflags>-D__ARM_ARCH_5E__
<compileflags>-D__ARM_ARCH_5TE__
<compileflags>-Wno-psabi
<compileflags>-march=armv5te
<compileflags>-mtune=xscale
<compileflags>-msoft-float
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-std=c++11
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-I$(androidNDKRoot)/platforms/android-9/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
# @Moss - Above are the 'oficial' android flags
<architecture>arm
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-fdata-sections
<cxxflags>-D__arm__
<cxxflags>-D_REENTRANT
<cxxflags>-D_GLIBCXX__PTHREADS
;
option.set keep-going : false ;
3.4 创建批处理命令,内容如下
b2 --without-context --without-coroutine --without-program_options --without-container --without-iostreams --without-locale --without-signals --without-wave --without-timer --without-mpi --without-log --without-test --without-atomic --without-chrono --without-filesystem --without-graph --without-graph_parallel --without-math --without-python --without-random link=static threading=multi threadapi=pthread target-os=linux toolset=gcc-android
b2 参数说明
- --without 表示不编译这个项目
- --with 表示要编译这个项目
3.5 运行3.4创建的批处理,应该就能生成静态库文件,可以在项目中使用了
后记:如果还是有问题,详细查看我之前的步骤,欢迎大家来和我讨论
windows下编译Android版本的boost库文件的更多相关文章
- ubuntu下编译android jni到so库的mk文件配置
项目根目录下的Android.mk文件 LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional L ...
- 在Windows下编译Emacs
在Windows下编译Emacs Windows下编译好的Emacs主要有两个版本,一个来自http://nqmacs.sourceforge.net/,另一个来自http://www.crasseu ...
- windows下编译和安装boost库
boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...
- 如何在WINDOWS下编译BOOST C++库 .
如何在WINDOWS下编译BOOST C++库 cheungmine 2008-6-25 写出来,怕自己以后忘记了,也为初学者参考.使用VC8.0和boost1.35.0. 1)下载boost ...
- osg for android学习之一:windows下编译(亲测通过)【转】
1. 首先需要一个OSG for android的环境 (1)NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一):新 ...
- 编译 Android 版本的 Opus 音频编解码库的方法
Opus 音频编解码库是 Speex 音频编解码库的下一代版本,从编解码性能以及质量上来讲都有了长足的进步.Opus 的编译非常简单,但是官方并未给出详细的 Android 版本编译指南,查找了大量资 ...
- linux下编译qt5.6.0静态库——configure配置
linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...
- linux下编译qt5.6.0静态库——configure配置(超详细,有每一个模块的说明)(乌合之众)
linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...
- 一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg
一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...
随机推荐
- Constraint where both columns cannot be null, but one can
ALTER TABLE TableA ADD CONSTRAINT CK_BothDepartsNotNull CHECK (departA IS NOT NULL OR departB IS NOT ...
- 【LeetCode】462. Minimum Moves to Equal Array Elements II
Given a non-empty integer array, find the minimum number of moves required to make all array element ...
- @Transactional注解详解
默认遇到throw new RuntimeException("...");会回滚 需要捕获的throw new Exception("...");不会回滚 ...
- SecureCRT 7.3.4破解版(含注册机)
不用说你肯定知道SecureCRT用途是什么,这个号称最好用的ssh连接工具却不是免费的,所以找了很久才找到最新版本的SecureCRT 7.3.4破解版,其实只要是SecureCRT 7.3.x版本 ...
- 转 delphi SelText,GetText,SetText用法
转自:http://blog.163.com/wll_009/blog/static/1173731172009102452632968/ 这几个都跟选区有关的,就是选中一串字符串,选中的会变蓝色Se ...
- Ubuntu环境变量——系统变量和用户变量
系统变量: 对所有用户有效果 /etc/profile /etc/environment 两个命令只用一个就可以,原则上是重启后修改生效,但是经过验证可以通过执行以下命令实现: source /etc ...
- FZU 2086 餐厅点餐
好久不写博客了……得有快一个月了……看到大神们一篇篇博文 唉……差好多……这一个月 有蓝桥杯还有校赛……校赛签到题都没签完 实力铁牌……不过蓝桥杯一等奖 五月份帝都之行还挺令人期待……清明小长假之前 ...
- 解决time_wait过多的问题
#netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’ LAST_ACK 14SYN_RECV 348ESTABLI ...
- jQuery,使用on代替delegate,live 写法区别
早期对页面上后期加载的动态元素,赋事件或值的时候,是使用live的. 由于效率比较低(其实数据不多也感觉不出来),后面使用delegate委托来代替了,再后面,1.7以后使用on 来代替delega ...
- The server instance Witness rejected configure request; read its error log file for more information. The reason 1427, and state 31, can be of use for
数据库服务器做了镜像之后,发现有错误信息 The server instance Witness rejected configure request; read its error log file ...