linux 编译/安装 boost

1,去官网下载源码包

  http://sourceforge.net/projects/boost/files/boost/1.55.0/

2,解压

  tar jxvf boost_1_55_0.tar.bz2

3, ./bootstrap.sh 进行配置 成功的话会有下列提示信息:

  Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2
  Detecting Python version... 2.6
  Detecting Python root... /usr
  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


4, ./b2 编译boost (注:需要很长时间)

  最后出现:The Boost C++ Libraries were successfully built!

       The following directory should be added to compiler include paths:

         ***/boost_1_50_0

       The following directory should be added to linker library paths:

         ***/boost_1_50_0/stage/lib

  表示安装成功,如果没有成功,说明出现error。

  ① fatal error: patchlevel.h: No such file or directory

    patchlevel.h 是python-dev 的头文件,检查 python-dev是否installded。 sudo apt-get install python-dev 问题解决。

      ②fatal error: bzlib.h: No such file or directory

           检查 bz2 是否installded .  sudo apt-get install python-dev 问题解决。 sudo apt-get install libbz2-dev 问题解决。

      ③g++: internal compiler error: Killed (program cc1plus)
   Please submit a full bug report,
   with preprocessed source if appropriate.
   See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

5, ./b2 install --prefix=/usr/local 

      安装后的boost头文件在/usr/local/include/boost里面,而相应的boost库在/usr/local/lib/libboost_*       

posted on 2014-07-06 21:29  尤菜  阅读(454)  评论(0编辑  收藏  举报