使用mips交叉编译器编译boost

来源:互联网 发布:在线视频解析源码 编辑:程序博客网 时间:2024/06/10 07:36

编译方式和arm交叉编译类似,不过我用的交叉编译器版本非常老,是3.40的

boost库,可以使用任意版本,下载地址:http://www.boost.org

编译方法

1.      下载解压boost库到任意位置,如/home/boost_1_48_0/

2.      切换目录至/home/boost_1_48_0,运行bootstrap.sh,此时在当前目录下会生成bjam这个程序,另外产生project-config.jam编译配置文件

3.      修改project-config.jam为以下内容:

# Boost.Build Configuration

# Automatically generated by bootstrap.sh

 

import option ;

import feature ;

 

# Compiler configuration. This definition will be used unless

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

# file.

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

{

#关键是以下这句的修改

using gcc : mips : mipsel-linux-g++ ;

#编译arm版本则改为 using gcc : arm : arm-none-linux-gnueabi-g++ ;

#另外生成目录或者放置编译结果的目录请自行另作选择

}

 

project : default-build <toolset>gcc ;

 

# Python configuration

using python : 2.7 : /usr ;

 

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

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

# Options specified on the command line completely

# override this variable.

libraries =  ;

 

# These settings are equivivalent to corresponding command-line

# options.

option.set prefix : /usr/mips ;

option.set exec-prefix : /usr/mips ;

option.set libdir : /usr/mips/lib ;

option.set includedir : /usr/mips/include ;

 

# Stop on first error

option.set keep-going : false ;

 

4.      执行命令行:

./bjam stage--with-thread --with-signals --with-system link=static runtime-link=sharedthreading=multi --layout=tagged

此处仅编译3个所需要用到的库,编译多的话,可能会有错误,编译完成后在/home/boost_1_48_0/stage/lib下面能看到生成的库文件

5.      创建目录/usr/mips/usr/mips/include/usr/mips/lib;将/home/boost_1_48_0/boost/这个目录拷贝至/usr/mips/include下,将/home/boost_1_48_0/stage/lib下的库文件拷贝至/usr/mips/lib下。

6.      Boost编译安装完成

 


原创粉丝点击