Compile boost (zz) on Win32 System)

Source: Internet
Author: User

Address: http://hi.baidu.com/hardcorn/blog/item/c8cb1b17284fe7074b90a76f.html

Compile boost on the Win32 system. We use WINXP as an example:

Boost contains a tool similar to make/nmake: bjam, which is the compilation method recommended by boost,
We use bjam to compile boost, and the source code of bjam is also included in the boost source code package.

1. Compile bjam first
A) decompress the boost source code package. We set boost_root to indicate the root directory of Boost after the package is decompressed.
...
D: "> Cd D:" SVN "Boost-trunk"

D: "SVN" Boost-trunk ">

B) go to the source code directory of bjam: $ (boost_root) "Tools" Jam "src"
...
D: "SVN" Boost-trunk> Cd Tools "Jam" src

D: "SVN" Boost-trunk "Tools" Jam "src>

C) then execute the build. BAT to compile bjam. This script can contain a parameter during execution.
it is used to specify the compiler for compiling bjam, if no parameters are included, the system automatically checks the compiled
tool installed in the current system. Currently, boost supports the following compilation tools on Windows:
BORLAND:
como:
GCC:
gcc-nocygwin:
intel-win32:
metrowerks:
mingw:
msvc: compiled with vc6.0
vc7:
vc8:
vc9:

let's build. bat checks on its own, because vc6.0 and vc7.0, build are installed on my machine at the same time. bat tries to use the latest version during
automatic check, so it uses vc7.0 to compile bjam:
D: "SVN" Boost-trunk "Tools" Jam "src> build. bat
"call_if_exists"
setting environment for using Microsoft Visual Studio. NET 2003 tools.
(if you have another version of Visual Studio or visual C ++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version .)
###< BR >### using 'vc7' toolset.
###

D: "SVN" Boost-trunk "Tools" Jam "src> RD/S/Q Bootstrap
...
...
...
Updated 1 target...
D: "SVN" Boost-trunk "Tools" Jam "src>

D) Get the compiled bjam. After compilation is complete, it will be generated in the current directory where the compilation result is saved: Bin.Platform type
My current system is WINXP (NT) on x86, so this directory is: bin. ntx86. The compiled bjam is saved in this
Directory: bjam.exe

2. First Use bjam to compile a boost library. Let's try compiling the Test Library.

A) arrive at the test database through the command lineCodeDirectory:
...
D: "> Cd SVN" Boost-trunk "Libs" Test

D: "SVN" Boost-trunk "Libs" test>

B) There is a file in this directory: jamfile.v2,bjam.exe through this file to learn how to compile test, which is similar
Make/nmakemakefilefile. We can directly call bjam.exe in this directory to compile test:
D: "SVN" Boost-trunk "Libs" test>... "..." Tools "Jam" src "bin. ntx86" bjam.exe
Warning: graph library does not contain optional graphml reader.
Note: To enable graphml support, set expat_include and expat_libpath to
Note: directories containing the expat headers and libraries, respectively.
Warning: Skipping optional message passing interface (MPI) Library.
Note: To enable MPI support, add "using MPI;" to user-config.jam.
Note: to suppress this message, pass "-- without-MPI" to bjam.
Note: otherwise, you can safely ignore this message.
...
...
** Passed **... "..." bin. V2 "Libs" test "example" unit_t...
Test
... Failed updating 2 targets...
... Skipped 2 targets...
... Updated 434 targets...

C) the debug version is compiled by default, and all unit tests are compiled and called. The compiled binary files are saved in:
$ (Boost_root) "bin. V2:

D: "SVN" Boost-trunk> Cd bin. v2

D: "SVN" Boost-trunk "bin. V2> tree
Folder path list
The serial number of the volume is 000007bc 6057: ac36.
D :.
└ ── Libs
Upload-test
│ ─ ── Build
│ ─-Msvc-7.1
│ Mongo── debug
│ └ ── Asynch-exceptions-on
│ ├ ── Link-static
│ Sampled-threading-Multi
│ Sampled-threading-Multi
│ Sampled-Example
│ ─ ── Const_string_test.test
│ Sampled-msvc-7.1
│ ─ ── Debug
│ Sampled-threading-Multi
│ Sampled-est_example1.test
│ Sampled-msvc-7.1
│ ─ ── Debug
│ Sampled-threading-Multi
│ ├ ── Est_example2.test
│ Sampled-msvc-7.1
│ ─ ── Debug
│ Sampled-threading-Multi
│ Sampled-exec_mon_example.test
│ Sampled-msvc-7.1
...........

3. Compile the entire boost:
A) There is a file in the boost root directory: jamroot. we can directly execute bjam.exe under the boostroot directory.
You can use this file to compile the root boost library.
D: "SVN" Boost-trunk> Tools "Jam" src "bin. ntx86" bjam.exe
Warning: graph library does not contain optional graphml reader.
Note: To enable graphml support, set expat_include and expat_libpath to
Note: directories containing the expat headers and libraries, respectively.
Warning: Skipping optional message passing interface (MPI) Library.
Note: To enable MPI support, add "using MPI;" to user-config.jam.
.......

B) There are many compilation options available in the jamroot file. You can open this file in the file editor to learn more about the compilation details.
for example, you can use parameters to specify a library for compiling (or not compiling) boost, such as the Test Library:
D: "SVN" Boost-trunk> Tools "Jam" src "bin. ntx86 "bjam.exe -- With-test stage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.