歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> CentOS下編譯boost1.48.0

CentOS下編譯boost1.48.0

日期:2017/3/1 10:03:41   编辑:Linux編程

背景
操作系統:CentOS6.2
編譯器:gcc
boost:1.48.0
boost下載地址:http://www.linuxidc.com/Linux/2012-01/51941.htm

文檔約定
$BOOST_ROOT:表示boost的根目錄,本例為/vendor/boost/boost_1_48_0。

1)生成bjam
進入$BOOST_ROOT
#cd
執行bootstrap.sh,生成bjam
#./bootstrap.sh


2)編譯
在$BOOST_ROOT/下執行如下命名:
bjam --toolset=msvc-8.0 --with-<library> stage debug threading=multi link=shared
bjam部分選項,參數說明:
--toolset=gcc|msvc-8.0|msvc-10.0|borland-6.0,開發環境/編譯器,msvc-8.0為vs2005,msvc-10.0為vs2010,borland-6.0為C++builder6.0
threading=single|multi,決定使用單線程還是多線程庫,multi為多線程,single為單線程
link=shared|static,連接選項,shared為共享dll,static為靜態庫
runtime-link=static|shared,決定是靜態還是動態鏈接C/C++標准庫
--with-<library>,只編譯指定的庫,如輸入--with-regex就只編譯regex庫
--show-libraries 顯示boost包含的庫
生成文件輸出在$BOOST_ROOT/bin.v2/libs/regex/build/msvc-8.0/debug/threading-multi


例如,編譯filesystem
bjam --toolset=gcc --with-filesystem stage debug threading=multi link=shared
編譯所有庫
bjam --toolset=gcc stage debug threading=multi link=shared

Copyright © Linux教程網 All Rights Reserved