安裝包:python
下載路徑:linux
http://sourceforge.net/projects/boost/files/boost/1.55.0/ios
下載 boost_1_55_0.zipshell
1.首先運行boost解壓目錄下的bootstrap
unzip boost_1_55_0.zip
2.運行安裝包自帶的腳本:less
./bootstrap.sh
2.修改生成的project-config.jam文件,具體能夠參照ide
修改:(共五處)測試
using gcc : arm : arm-none-linux-gnueabi-gcc ; ui
option.set prefix :(交叉編譯器所在位置);this
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&nbsp;--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 -
測試文件BoostTest.cpp以下:
#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上能夠測試是否能運行;