This blog (http://blog.csdn.net/livelylittlefish) Post author (three two one @ fish) related research, learning content made notes, welcome to the majority of friends correct! 
 
 
How to compile boost on Linux
 
 
 
Boost compilation uses the bjam (boost JAM) tool specially developed for Boost instead of making, which has become a recognized standard ).
 
This article takes boost1.40 as an example. The programming environment on the Linux platform is gcc4.4.1. Assume that the boost code is in the/usr/src/boost_1_40_0 directory. The steps are as follows.
 
 
 
1. Obtain bjam
 
 
 
There are three methods to obtain bjam:
 
Method 1: The boost website provides pre-compiled bjam executable programs on various platforms for direct download and use.
 
Method 2: Compile the executable program from the bjam Code provided in the boost source code.
 
Method 3: generate bjam using the Bootstrap program.
 
 
 
Method 1:
 
# Apt-Get install bjam
 
 
 
Method 2:
 
(1) # cd/usr/src/boost_1_40_0/tools/JAM/src
 
(2) #./build. Sh
 
 
 
After compilation:
 
The generated executable file is
 
#/Usr/src/boost_1_40_0/tools/JAM/src/bin. linuxx86/bjam
 
Copy bjam.exe to the directory where the source code is located.
# Cp bin. linuxx86/bjam/usr/src/boost_1_40_0
 
 
 
Method 3:
 
(1) # cd/usr/src/boost_1_40_0
 
(2) #./Bootstrap. Sh
 
This method directly generates the bjam file in the boost source code directory.
 
 
 
2. Modify bjam Configuration
 
 
 
You need to modify the configuration file of bjam before using bjam. Configuration file for Linux:
 
/Usr/src/boost_1_40_0/tools/build/v2/user-config.jam
 
 
 
Modify as follows. Note: During my experiment, it seems that it is normal to do not modify it.
 
 
 
Remove the comment symbol '#' before '# using GCC;' in 43 lines, indicating that GCC is used for compilation.
 
If you want to use stlport as its standard library, remove '#' before 75 rows.
 
 
 
3. Complete boost Compilation
 
 
 
Complete boost compilation to generate static and dynamic libraries for all debugging and release versions.
 
 
 
Method 1:
 
# Cd/usr/src
 
# Wget http://sourceforge.net/projects/boost/files/boost/1.40.0/boost_1_40_0.tar.bz2
 
# Tar -- Bzip2-xvf boost_1_40_0.tar.bz2
 
# Cd boost_000040_0
 
 
 
# Bjam -- toolset = GCC -- Build-type = complete stage
 
Or
 
#./Bjam -- Build-type = complete -- layout = versioned
 
Or
 
#./Bjam
 
 
 
Method 2:
 
# Cd/usr/src/boost_1_40_0/tools/JAM
 
#./Build_dist.sh
 
It also completes compiling of bjam and boost on the Linux platform, and generates static and dynamic libraries for all debug and release versions. This method is not recommended.
 
 
 
After compilation is successful, it will be in/usr/src/boost_1_40_0/bin. the V2 directory generates many files, including. A and. so.1.40.0 file, which is required to use boost on the Linux platform. Other files can be deleted.
 
 
 
Install
 
#./Bjam install
 
Install the generated Library to the/Urs/local/lib directory by default.
 
 
 
4-part boost Compilation
 
 
 
It is time and effort-consuming to complete boost compilation, and these libraries are not all used during the development process. Therefore, bjam also allows you to select the library to compile.
 
 
 
On the basis of full compilation, you can use -- with or-without to open or close the compilation of a database. For example, compile only the date_time database:
 
# Cd/usr/src/boost_1_40_0
 
#./Bjam -- toolset = msvc -- with-date_time -- Build-type = complete stage
 
 
 
Of course, bjam has many other options, such as specifying the installation path and debugging or release. For details, refer to the bjam document or help.