Ubuntu 13.04編譯boost1.54

由於要用基於GCC4.8.1的boost最新版本的庫,默認apt-get install 安裝的是boost1.53, 而且基於GCC4.7.3,不是我想要的。因此決定下載源代碼本身編譯。html

下載(後面的路徑可能會變,具體參考boost網站連接)python

 

wget -O boost_1_54_0.tar.bz2 http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.bz2?r=http%3A%2F%2Fwww.boost.org%2Fusers%2Fhistory%2Fversion_1_54_0.html&ts=1375162670&use_mirror=jaist


解壓:linux

 

 

tar --bzip2 -xf ./boost_1_54_0.tar.bz2


開始編譯,所有編譯耗時太多,因此我僅選擇我須要的庫:ios

 

先用下面的命令查看有多少庫能夠編譯:bootstrap

 

./bootstrap.sh --show-libraries
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2

The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by including
the headers only.

The Boost libraries requiring separate building and installation are:
    - atomic
    - chrono
    - context
    - coroutine
    - date_time
    - exception
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - log
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - timer
    - wave


而後就編譯我要的庫:app

 

 

./bootstrap.sh --with-libraries=system,filesystem,log,thread
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/boost-build2/doc/html/index.html


而後運行下面的命令完成編譯。dom

 

 

./b2

 

耐心等待。不過由於不是編譯全部庫。時間會少不少。之後須要再來編譯。很快看到結果:ide

 

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /usr/src/boost_1_54_0

The following directory should be added to linker library paths:

    /usr/src/boost_1_54_0/stage/lib

 

忘記安裝了。再運行./b2 install 命令,默認安裝在網站

/usr/local/lib目錄下ui

頭文件在

/usr/local/include/boost目錄下

相關文章
相關標籤/搜索