env:

      windows xp 32 bit
      mingw
      official  NDK

1. 下载源代码
    地址是 :http://sourceforge.net/projects/boost/files/boost/1.54.0/
    本文下载的是 boost_1_54_0.7z 
2. 解压源代码到任意目录
    本问解压后匹配文件:  ***/boost154/tools/build/v2/user-config.jam
3. 生成bjam.exe
    打开cmd.exe
    切换目录至 ***/boost154/

  输入命令: bootstrap.bat  回车

E:\boost\boost_1_54_0>bootstrap.bat

这样在***/boost154下生成  bjam.exe 和 b2.exe
    
 4. 修改bjam配置文件user-config.jam
    配置文件路径 ***/boost154/tools/build/v2/user-config.jam
    解压后此文件是全部注释的说明文件

  仿照其他博文 在最后加上如下注释内的内容  

     import os ;

     if [ os.name ] = CYGWIN || [ os.name ] = NT {
androidPlatform = windows ;
}
else if [ os.name ] = LINUX {
androidPlatform = linux-x86_64 ;
}
else if [ os.name ] = MACOSX {
androidPlatform = darwin-x86 ;
} modules.poke : NO_BZIP2 : 1 ;
ANDROID_NDK = ../../android/android-ndk-r8e ;
using gcc : android4.6 : $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ :
<archiver>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar
<ranlib>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib
<compileflags>--sysroot=$(ANDROID_NDK)/platforms/android-9/arch-arm
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/include
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include
<compileflags>-DNDEBUG
<compileflags>-D__GLIBC__
<compileflags>-DBOOST_FILESYSTEM_VERSION=3
<compileflags>-lstdc++
<compileflags>-lgnustl_shared
<compileflags>-mthumb
<compileflags>-fno-strict-aliasing
<compileflags>-std=gnu++11
<compileflags>-O2
;

注意:
     ANDROID_NDK 为NDK跟目录,匹配文件如: ../../android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/include
     这段配置比较微妙,最好复制后进行修改,开始自己写的时候不知道哪里错了,一直提示 大写 Error android4.6 一类的错误,无法开始编译
     
 5. MinGW中输入bjam编译命令
    打开mingw命令端口,切换至 ***/boost154/

  输入如下注释中的命令,并回车
    

$ bjam --without-python toolset=gcc-android4.6 link=static runtime-link=static target-os=linux --stagedir=android

注意:
     --stagedir
      指定编译后库的存放目录,命令输入时的当前路径,
      本文是 ***/boost154/android ,结果保存在 ***/boost154/android/lib 中
     --without-python
      不编译python库,
      使用 --without-***屏蔽库
      库列表可以是
       atomic               
       chrono               
       context              
       coroutine            
       date_time            
       exception            
       filesystem           
       graph                
       graph_parallel       
       iostreams            
       locale               
       log                  
       math                 
       mpi                  
       program_options      
       python               
       random               
       regex                
       serialization        
       signals              
       system               
       test                 
       thread               
       timer                
       wave

命令回车后首先会输出当前配置  

     Building the Boost C++ Libraries.

     Performing configuration checks

      - 32-bit                   : yes (cached)
- arm : yes (cached)
- has_icu builds : no (cached)
warning: Graph library does not contain MPI-based parallel componen
note: to enable them, add "using mpi ;" to your user-config.jam
- zlib : no (cached)
- iconv (libc) : no (cached)
- iconv (separate) : no (cached)
- icu : no (cached)
- icu (lib64) : no (cached)
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- x86 : no (cached)
- gcc visibility : yes (cached)
- long double support : yes (cached)
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message. Component configuration: - atomic : building
- chrono : building
- context : building
- coroutine : building
- date_time : building
- exception : building
- filesystem : building
- graph : building
- graph_parallel : building
- iostreams : building
- locale : building
- log : building
- math : building
- mpi : building
- program_options : building
- python : not building
- random : building
- regex : building
- serialization : building
- signals : building
- system : building
- test : building
- thread : building
- timer : building
- wave : building

编译结束后输出

     ...failed updating 5 targets...
...skipped 12 targets...
...updated 51 targets...

与官方下载库比较, ***/boost154/android/lib/中的库,没有生成有
          context
        filesystem
            locale
            log
            python(输入命令时设置不编译,可能需要第三方库
            thread
            zlib
    下面的博文写NDK不支持wide chars,但是wserialization 、serialization都生成了.

6.参考
    
    本文方法主要参考
    http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/
    这篇播放写NDK不支持wide chars,并且 CrystaX官网也写NDK不支持wide chars,
    
    boost-for-android 补丁工程
    https://github.com/MysticTreeGames/Boost-for-Android/archive/master.zip
    提供补丁修改boost代码,貌似能解决上面编译不过的库
    提供批处理和bjam配置文件...不会用......
    
    CrystaX官方
    http://www.crystax.net/en/android/ndk?format=php
    
    boost邮件关于android/ios的问答
    http://lists.boost.org/Archives/boost/2012/12/199676.php
    
    几个编译笔记
    http://www.cppblog.com/sunicdavy/archive/2013/07/20/201993.html
    http://blog.sina.com.cn/s/blog_a6946c8a01016aot.html

----------------------2013-09-18---11:43:13

  重新编译,均使用MinGW

1.Mingw编译bjam.exe

  Mingw终端切换至   

  boost_1_53_0\tools\build\v2\engine 目录 执行
  $ build.sh
  等到提示:
    [COMPILE] bin.ntx86\b2.exe
    [COPY] bin.ntx86\bjam.exe
    ...updated 2 targets...
     
  将 boost_1_53_0\tools\build\v2\engine\bin.ntx86 目录下的bjam.exe拷贝到 boost_1_53_0 目录下

2.修改bjam配置文件
  boost_1_53_0\tools\build\v2\user-config.jam

  

import os ;

if [ os.name ] = CYGWIN || [ os.name ] = NT {
androidPlatform = windows ;
}
else if [ os.name ] = LINUX {
androidPlatform = linux-x86_64 ;
}
else if [ os.name ] = MACOSX {
androidPlatform = darwin-x86 ;
} modules.poke : NO_BZIP2 : 1 ;
ANDROID_NDK = ../../code_other/android/android-ndk-r8e ;
using gcc : android4.6
:
$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++
:
<archiver>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar
<ranlib>$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib
<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>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-I$(ANDROID_NDK)/platforms/android-9/arch-arm/usr/include
<compileflags>-Wa,--noexecstack
<compileflags>-DANDROID
<compileflags>-D__ANDROID__
<compileflags>-DNDEBUG
<compileflags>-O2
<compileflags>-g
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/include
<compileflags>-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include
;

    需要跟上 ranlib 这个标签,否则会显示 archiver 
        '"..\..\code_other\android\android-ndk-r8e\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin"' 不是内部或外部命令,
        也不是可运行的程序或批处理文件。不理解,gcc 能找到,ar找不到.

3.打补丁

    将https://github.com/MysticTreeGames/Boost-for-Android 提供的1.53的补丁拷贝至 boost_1_53_0\MinGW终端切换至 boost_1_53_0 的父目录,执行

  $ patch -Np1 -d boost_1_53_0 < boost_1_53_0/boost-1_53_0.patch

      会输出:

patching file boost/asio/detail/socket_types.hpp
Hunk #1 succeeded at 124 (offset 1 line).
patching file boost/asio/ip/impl/address_v6.ipp
patching file boost/config/user.hpp
patching file boost/detail/endian.hpp
patching file boost/interprocess/detail/workaround.hpp
patching file libs/filesystem/src/operations.cpp
patching file tools/build/v2/tools/android.jam
patching file tools/build/v2/tools/android.py

4.编译

    MinGW切换至目录 boost_1_53_0,执行

    $ bjam --without-python toolset=gcc-android4.6 link=static runtime-link=static target-os=linux --stagedir=android_static

    

    libboost_thread-gcc-mt-s-1_53.a库无法生成.还是提示: libs\thread\src\win32\thread.cpp:31:21: fatal error: process.h: No such file or directory

    libboost_context-gcc-mt-s-1_53.a没有生成,'armasm' 不是内部或外部命令,也不是可运行的程序

windows下编译boost for android的更多相关文章

  1. 如何在WINDOWS下编译BOOST C++库 .

    如何在WINDOWS下编译BOOST C++库 cheungmine 2008-6-25   写出来,怕自己以后忘记了,也为初学者参考.使用VC8.0和boost1.35.0.   1)下载boost ...

  2. Android ijkplayer在windows下编译并导入Android Studio

     我是看着里面的步骤来做的,由于我自己对Linux环境和命令不熟悉,导致我对Cygwin的知识为零,在编译ijkplayer的时候走了一点弯路,需要的同学先去看一下上面的这篇文章,我这边是对上面文章做 ...

  3. windows下编译Boost

    当前boost最新版本为1.55,下载地址:http://sourceforge.net/projects/boost/files/boost/1.55.0/或者从官网(www.boost.org)下 ...

  4. Ubuntu下编译boost for Android

    下载https://github.com/moritz-wundke/Boost-for-Android 解压后进入目录 运行 ./build-android.sh $(NDK_ROOT) NDK_R ...

  5. windows下编译Boost库

    下载源码 boost_1_66_0.7z 生成编译工具 D:\Project\boost_1_66_0> bootstrap.bat 配置Python环境变量(使用VS2017自带的32位pyt ...

  6. osg for android学习之一:windows下编译(亲测通过)【转】

    1. 首先需要一个OSG for android的环境 (1)NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一):新 ...

  7. windows下编译和安装boost库

    boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...

  8. react-native —— 在Windows下搭建React Native Android开发环境

    在Windows下搭建React Native Android开发环境 前段时间在开发者头条收藏了 @天地之灵_邓鋆 分享的<在Windows下搭建React Native Android开发环 ...

  9. 一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

随机推荐

  1. Spark集群数据处理速度慢(数据本地化问题)

    SparkStreaming拉取Kafka中数据,处理后入库.整个流程速度很慢,除去代码中可优化的部分,也在spark集群中找原因. 发现: 集群在处理数据时存在移动数据与移动计算的区别,也有些其他叫 ...

  2. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-如何把FBD功能块转换成ST语言

    假如我定义了一个MC_Power的标准功能块,我想知道它对应的ST语言   在MAIN(ST语言界面下)右击,Input Assistant,然后找到Standard Function Blocks, ...

  3. 病毒木马查杀实战第022篇:txt病毒研究

    前言 反病毒爱好者们非常喜欢讨论的一个问题就是,现在什么样的病毒才算得上是主流,或者说什么样的病毒才是厉害的病毒呢?我们之前的课程所解说的都是Ring3层的病毒.所以有些朋友可能会觉得.那么Ring0 ...

  4. mui 选项卡

    方法一:通过css 实现选项卡 <div id="slider" class="mui-slider"> <div id="slid ...

  5. [1-5] 把时间当做朋友(李笑来)Chapter 5 【小心所谓成功学】 摘录

    有一个事实非常简单,却令人难以接受.这世界上所有的资源并非平均分布在每一个人的身上,能够比较接近地表示这种分布情况的数学曲线叫做“正态分布曲线”(Normal Distribution Curve) ...

  6. <转>C++位运算详解

    原文转自:http://www.crazycpp.com/?p=82 前言 以前收藏过一篇讲C++位操作的文章,这次博客搬家,以前的数据都没有保留,整理谷歌网站管理后台的时候,发现不时的还有网友有在查 ...

  7. node.js 学习03

    node.js学习03 解决浏览器接收服务端信息之后乱码的问题: 服务器通过设置http响应报文头,告诉浏览器使用相应的编码 来解析网页. res.setHeader('Content','text/ ...

  8. Hive row_number() 等用法

    1.row_number() over()排序功能: (1) row_number() over()分组排序功能: 在使用 row_number() over()函数时候,over()里头的分组以及排 ...

  9. JAVASCRIPT中{} + {}的结果是什么?

    转自:http://www.heyria.com/index.php/2014/01/js-object-plus-object/ 当对象或者数组相加的时候,会产生有点意外的结果. 这篇文章主要是解释 ...

  10. Atitit. 包厢记时系统 的说明,教程,维护,故障排查手册v2 pb25.doc

    Atitit. 包厢记时系统 的说明,教程,维护,故障排查手册v2 pb25.doc 1. 服务器方面的维护1 1.1. 默认情况下,已经在系统的启动目录下增加了 个启动项目1 1.2. 后台服务.保 ...