移植boost_1_55_0至arm的方法小结

安装包:

下载路径:

http://sourceforge.net/projects/boost/files/boost/1.55.0/

下载 boost_1_55_0.zip

1.首先运行boost解压目录下的

   unzip boost_1_55_0.zip

2.运行安装包自带的脚本:

   ./bootstrap.sh

2.修改生成的project-config.jam文件,具体可以参照

修改:(共五处)

   using gcc : arm : arm-none-linux-gnueabi-gcc ; 

   option.set prefix :(交叉编译器所在位置);

   option.set exec-prefix :(交叉编译器所在位置)/bin ;

   option.set libdir :(交叉编译器所在位置)/lib ;

   option.set includedir :(交叉编译器所在位置)/include ;

  

修改后配置文件如下:

 1 # Boost.Build Configuration

 2 # Automatically generated by bootstrap.sh

 3

 4 import option ;

 5 import feature ;

 6

 7 # Compiler configuration. This definition will be used unless

 8 # you already have defined some toolsets in your user-config.jam

 9 # file.

10 if ! gcc in [ feature.values <toolset> ]

11 {

12     using gcc : arm : arm-linux-gcc ;

13 }

14

15 project : default-build <toolset>gcc ;

16

17 # Python configuration

18 using python : 2.6 : /usr ;

19

20 # List of --with-<library> and --without-<library>

21 # options. If left empty, all libraries will be built.

22 # Options specified on the command line completely

23 # override this variable.

24 libraries =  ;

25

26 # These settings are equivivalent to corresponding command-line

27 # options.

28 option.set prefix : /usr/local/arm/4.3.3 ;

29 option.set exec-prefix : /usr/local/arm/4.3.3/bin ;

30 option.set libdir : /usr/local/arm/4.3.3/lib ;

31 option.set includedir : /usr/local/arm/4.3.3/include ;

32

33 # Stop on first error

34 option.set keep-going : false ;

 

3.测试编译效果

./bjam stage --layout=tagged --build-type=complete

还可以加(link=shared runtime-link=shared threading=multi)等编译参数

生成的动/静态库在boost/stage/lib 目录下

 

4.将boost文件夹拷贝到arm-linux-gcc 的include目录下;

         如何知道arm-linux-gcc 的头文件以及库文件路径? 采用shell命令:

echo 'main(){}' | arm-linux-gcc -E -v -

测试文件如下:

#include<iostream>

#include<boost/lexical_cast.hpp>

int main()

{

int a = boost::lexical_cast<int>("1008611");

std::cout << a <<std::endl;

return 0;

}


编译命令:

arm-linux-g++ BoostTest.cpp -L ../stage/lib/ -o test


拷贝test到arm上可以测试是否能运行;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值