使用mips交叉編譯器編譯boost

編譯方式和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編譯安裝完成

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章