# 编译boost库

编译boost库

eg：

E:/MS VS 2005/Vc 8/bin/>
1. 这里，进入boost解压的目录，E:/boost_1_34_1/tools/jam/src，执行build.bat，编译出bjam.exe（编译结果位于：E:/boost_1_34_1/tools/jam/src/bin.ntx86）；
2. Copy bjam.exe 到E:/boost_1_34_1目录下，然后执行：bjam.exe 来编译，具体可以参考：

First, find the toolset corresponding to your compiler in the following table.

Note

If you previously chose a toolset for the purposes of building bjam, you should assume it won't work and instead choose newly from the table below.

Toolset Name Vendor Notes
acc Hewlett Packard Only very recent versions are known to work well with Boost
borland Borland
como Comeau Computing Using this toolset may require configuring another toolset to act as its backend
cw Metrowerks/FreeScale The CodeWarrior compiler. We have not tested versions of this compiler produced since it was sold to FreeScale.
dmc Digital Mars As of this Boost release, no version of dmc is known to handle Boost well.
darwin Apple Computer Apple's version of the GCC toolchain with support for Darwin and MacOS X features such as frameworks.
gcc The Gnu Project Includes support for Cygwin and MinGW compilers.
hp_cxx Hewlett Packard Targeted at the Tru64 operating system.
intel Intel
kylix Borland
msvc Microsoft
qcc QNX Software Systems
sun Sun Only very recent versions are known to work well with Boost.
vacpp IBM The VisualAge C++ compiler.

If you have multiple versions of a particular compiler installed, you can append the version number to the toolset name, preceded by a hyphen, e.g. intel-9.0 or borland-5.4.3. On Windows, append a version number even if you only have one version installed (unless you are using the msvc or gcc toolsets, which have special version detection code) or auto-linking will fail.

### Select a Build Directory

Boost.Build will place all intermediate files it generates while building into the build directory. If your Boost root directory is writable, this step isn't strictly necessary: by default Boost.Build will create a bin.v2/ subdirectory for that purpose in your current working directory.

### Invoke bjam

Change your current directory to the Boost root directory and invoke bjam as follows:

bjam --build-dir=build-directory --toolset=toolset-name stage

For example, your session might look like this:4

C:/WINDOWS> cd C:/Program Files/boost/boost_1_34_1C:/Program Files/boost/boost_1_34_1> bjam ^More? --build-dir=C:/temp/build-boost ^More? --toolset=msvc stage

Building the special stage target places Boost library binaries in the stage/ subdirectory of your build directory.

Note

bjam is case-sensitive; it is important that all the parts shown in bold type above be entirely lower-case.

For a description of other options you can pass when invoking bjam, type:

bjam --help

In particular, to limit the amount of time spent building, you may be interested in:

• reviewing the list of library names with --show-libraries
• limiting which libraries get built with the --with-library-name or --without-library-name options
• choosing a specific build variant by adding release or debug to the command line.

## Install Visual Studio (2005 or .NET 2003) Binaries

The installer supplied by Boost Consulting will download and install pre-compiled binaries into the lib/ subdirectory of the boost root, typically C:/Program Files/boost/boost_1_34_1/lib/. If you installed all variants of the Boost.Regex binary, you're done with this step. Otherwise, please run the installer again and install them now.

## 1   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_34_1$./configure --help Select your configuration options and invoke ./configure 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 $ ./configure --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,

$make 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. skip to the next step ## 2 Or, Build Custom Binaries If you're using a compiler other than your system's default, you'll need to use Boost.Build to create binaries. You'll also use this method if you need a nonstandard build variant (see the Boost.Build documentation for more details). Boost.Build is a text-based system for developing, testing, and installing software. To use it, you'll need an executable called bjam. ### 2.1 Get bjam bjam is the command-line tool that drives the Boost Build system. To build Boost binaries, you'll invoke bjam from the Boost root. Boost provides pre-compiled bjam executables for a variety of platforms. Alternatively, you can build bjam yourself using these instructions. ### 2.2 Identify Your Toolset First, find the toolset corresponding to your compiler in the following table. Note If you previously chose a toolset for the purposes of building bjam, you should assume it won't work and instead choose newly from the table below. Toolset Name Vendor Notes acc Hewlett Packard Only very recent versions are known to work well with Boost borland Borland como Comeau Computing Using this toolset may require configuring another toolset to act as its backend cw Metrowerks/FreeScale The CodeWarrior compiler. We have not tested versions of this compiler produced since it was sold to FreeScale. dmc Digital Mars As of this Boost release, no version of dmc is known to handle Boost well. darwin Apple Computer Apple's version of the GCC toolchain with support for Darwin and MacOS X features such as frameworks. gcc The Gnu Project Includes support for Cygwin and MinGW compilers. hp_cxx Hewlett Packard Targeted at the Tru64 operating system. intel Intel kylix Borland msvc Microsoft qcc QNX Software Systems sun Sun Only very recent versions are known to work well with Boost. vacpp IBM The VisualAge C++ compiler. If you have multiple versions of a particular compiler installed, you can append the version number to the toolset name, preceded by a hyphen, e.g. intel-9.0 or borland-5.4.3. ### 2.3 Select a Build Directory Boost.Build will place all intermediate files it generates while building into the build directory. If your Boost root directory is writable, this step isn't strictly necessary: by default Boost.Build will create a bin.v2/ subdirectory for that purpose in your current working directory. ### 2.4 Invoke bjam Change your current directory to the Boost root directory and invoke bjam as follows: bjam --build-dir=build-directory --toolset=toolset-name stage For example, your session might look like this: $ cd ~/boost_1_34_1\$ bjam --build-dir=/tmp/build-boost --toolset=gcc stage

Building the special stage target places Boost library binaries in the stage/ subdirectory of your build directory.

Note

bjam is case-sensitive; it is important that all the parts shown in bold type above be entirely lower-case.

For a description of other options you can pass when invoking bjam, type:

bjam --help

In particular, to limit the amount of time spent building, you may be interested in:

• reviewing the list of library names with --show-libraries
• limiting which libraries get built with the --with-library-name or --without-library-name options
• choosing a specific build variant by adding release or debug to the command line.

## 3   Expected Build Output

During the process of building Boost libraries, you can expect to see some messages printed on the console. These may include

• Notices about Boost library configuration—for example, the Regex library outputs a message about ICU when built without Unicode support, and the Python library may be skipped without error (but with a notice) if you don't have Python installed.

• Messages from the build tool that report the number of targets that were built or skipped. Don't be surprised if those numbers don't make any sense to you; there are many targets per library.

• Build action messages describing what the tool is doing, which look something like:

toolset-name.c++ long/path/to/file/being/built
• Compiler warnings.

## 4   In Case of Build Errors

The only error messages you see when building Boost—if any—should be related to the IOStreams library's support of zip and bzip2 formats as described here. Install the relevant development packages for libz and libbz2 if you need those features. Other errors when building Boost libraries are cause for concern.

If it seems like the build system can't find your compiler and/or linker, consider setting up a user-config.jam file as described in the Boost.Build documentation. If that isn't your problem or the user-config.jam file doesn't work for you, please address questions about configuring Boost for your compiler to the Boost.Build mailing list.

• 本文已收录于以下专栏：

### 相关文章推荐

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)