本文共 2498 字,大约阅读时间需要 8 分钟。
Boost 1.39使用笔记
Boost大部分还是以code的形势提供给用户使用的,但是涉及的三个库ICU、EXPAT、MPI是分别在实现regex、graph和mpi的时候所依赖的。先介绍Linux环境下的编译过程。 Easy Build and Install 在官方的帮助手册里会给你写着这么一段安装的介绍:Easy Build and Install Issue the following commands in the shell (don't type $; that represents the shell's prompt): $ cd path/to/boost_1_39_0 $ ./bootstrap.sh --help Select your configuration options and invoke ./bootstrap.sh again without the --help option. Unless you have write permission in your system's /usr/local/ directory, you'll probably want to at least use $ ./bootstrap.sh --prefix=path/to/installation/prefix to install somewhere else. Also, consider using the --show-libraries and --with-libraries= options to limit the long wait you'll experience if you build everything. Finally, $ ./bjam install will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory. 看到了么,生成了一个bjam,你可以把这个bjam拷贝到boost的解压目录里。是相当简单的Easy Build and install。 更为完备的编译参数配置 显然这样的编译设置我们是不能满足的,如果你希望能够拥有一个功能完备boost库来使用的参数的话,你就需要做一下参数的调整。 在解压目录中存在tools/build/v2/user-config.jam文件,该文件是专门配置变异参数的用户定义的配置文件。我们的编译器用的是gcc然后就把using gcc ;参数打开,在最后增加一个参数using mpi ;。增加此参数是为了生成MPI模块使用的。 第三方类库的准备 mpic++的支持 由于要生成MPI模块这里要依赖OpenMPI,可以参考一下下边连接中的一段内容:(http://www.nabble.com/MPI-auto-detection-failed:-unknown-wrapper-compiler-mpic%2B%2B-td23090203.html) First, you need to install the package "openmpi-devel". Do this as root: # yum install openmpi-devel This should bring in a number of dependencies, including a package named "mpi-selector". Once the installation has finished, done, use the MPI selector tool to choose the MPI toolset you've just installed. You can get a list of available MPI implementations using the command "mpi-selector". As an example, here's how it looks on my 64-bit CentOS 5.3 system: # mpi-selector --list openmpi-1.2.7-gcc-i386 openmpi-1.2.7-gcc-x86_64 Then, while still logged in as root, set the system-wide default by # mpi-selector --system openmpi-1.2.7-gcc-x86_64 Log out, then open a new terminal window (as your normal user) and try $ which mpic++ /usr/lib64/openmpi/1.2.7-gcc/bin/mpic++ 安装expat yum install expat* 安装ICU 可编译安装也可以用yum安装 设置环境变量,编译安装 export ICU_PATH=/usr/include<icu_include_path> export EXPAT_INCLUDE=/usr/include<expat_include_path> export EXPAT_LIBPATH=/usr/lib<expat_lib_path> ./bjam install 至此,结束转载地址:http://fpgmb.baihongyu.com/