Reposted from http://dozb.blogchina.com/2054610.html.
1. Make sure that the appropriate compiler has been installed on your OS. In the following Windows environment, use Windows 2000 + vc6 as an example, and in UNIX environment, use Solaris 9 + GCC 3.4.2 as an example;
2. The following $ boostdir indicates the boost storage directory. Modify it based on your actual situation.
1. Compile jam
1. Windows
Run build. bat under $ boostdir/tools/build/jam_src to compile jam. The compilation results will be stored under $ boostdir/tools/build/jam_src/bin. ntx86. If you encounter problems when executing the batch processing program, if the report cannot find the compiler-related program, execute
X:/program files/Microsoft Visual Studio/vc98/bin/vcvars32.bat
To create the basic environment variables of VC.
2. Solaris 9
Run./build. Sh under $ boostdir/tools/build/jam_src to compile jam. The compilation results will be stored in $ boostdir/tools/build/jam_src/bin. solarisx86.
Ii. Set Environment Variables
1. Windows
Right-click my computer and choose Properties> advanced> environment variable> User variable or system variable:
Add the bjam directory at the end of path, for example:
$ Boostdir/tools/build/jam_src/bin. ntx86
Create an environment variable msvcdir and enter the VC installation directory in the variable value column, for example:
X:/program files/Microsoft Visual Studio/vc98
2. Solaris 9
Add the compiled jam directory after path in. profile.
And add
Python_version = 2.3
Export python_version
Note: you do not need to set python_root. Jam will automatically process the configuration under Solaris.
Iii. Compilation
1. Windows
Run the following command under $ boostdir:
Jam-sboost_root =.-stools = msvc "-sbuild = debug release <runtime-link> static/dynamic"
Or
Bjam "-stools = msvc" Install
The preceding commands are explained as follows:
-S is set, which is used to set environment variables;
Boost_root boost storage directory
Tools toolset you selected, such as GCC, msvc (vc6), and vc7.1. In addition, there are gcc-stlport, msvc-stlport, and vc7.1-stlport, indicating that stlport is used at the same time. You can go to $ boostdir/tools/build/V1 to check the specific toolset supported.
Build compilation type. The above options indicate that the debug and release versions (four versions) that support static and dynamic links are compiled ).
The compiled lib and DLL files will be copied to the $ boostdir/bin/Boost/libs directory. However, these lib and DLL files are scattered in different directories for ease of use, you can find * in the preceding directory *. lib and *. DLL to find out these files, and then copy them all to the lib directory of VC and the System32 directory of windows, you can also create a directory dedicated to storing boost lib files, and then
Select Tools> Options> directories> library files, and add the preceding directory path to the environment settings of VC.
2. Solaris 9
Run the following command under $ boostdir:
Jam-sboost_root =.-stools = GCC "-sbuild = debug release <runtime-link> static/dynamic"
However, the following command is recommended:
Jam-sboost_root =.-stools = GCC "-sbuild = release <runtime-link> dynamic <optimization> speed"
This can greatly speed up compilation. At the same time, I personally think that it is best to use dynamic links to reduce the size of the target program, just like libstdc ++, I have never seen anyone go to the static link libstdc ++. a, although the static library is provided in the system.