Original source: http://blog.ehomy.net/archives/148
Work Platform: Fedora 12
Get the Boost library
Two compressed versions are officially available under Linux:
boost_1_43_0.tar.bz2
Boost_1_43_0.tar.gz
Locate one of the unix/linux packages directly, and then enter the following command
sudo wget http://downloads.sourceforge.net/project/boost/boost/1.43.0/boost_1_43_0.tar.gz?use_mirror=cdnetworks-kr-1
Extract
TAR-ZXVF boost_1.43.0.tar.gz
Go to unzip Directory
CD Boost_1_43_0
Compiling the installation
Use the following command to create a boost for your own build tool Bjam (to ensure that boost is compiled with Bjam on any platform), similar to GNU make.
./bootstrap.sh--prefix=/home/usrname/boost_1_43_0/boost_install
Boost will be installed in the/boost_install directory, and the unknown prefix will be installed by default to/usr/local/include and/usr/local/lib.
It is recommended that you review the help documentation below to learn about the default options and command
./bjam–help
The. Bjam command is in the format: bjam [Options] [Properties] [targets]
A description of the common options and attributes (properties), usually with the-prefix keyword is option, and the property is not.
–show-libraries
Displays a list of libraries that need to be compiled for use
–build-type=minimal|complete
–build-type=minimal is the default, and at this point, only the multithreaded static libraries and dynamic libraries that generate the release version of the dynamic link C run-time library (c + + standard library) are compiled under Linux.
–build-type=complete, under Unix/linux, you want to compile multiple variants (debug or release, multithreaded or single-threaded, static or dynamic, static or dynamic-link C run-time Library/c++ standard library). It is not recommended to compile all, time consuming space, advocating on-demand compilation.
–layout=versioned|tagged|system
The build policy that determines the name of the library to compile and the address directory of the header file. The default Windows –layout=versioned,linux under –layout=system.
When compiling multiple versions at the same time, it is best to set –layout=versioned or –layout=tagged, otherwise the compilation will fail, because some versions compile at the same time without specifying a naming policy, it is possible to create a naming conflict when outputting to a specified directory.
Note: You do not need to set this property when –build-type=complete. However, when specifying attributes such as Variant=debug,release, be sure to –layout=versioned or –layout=tagged.
–build-dir=dir
Specifies the directory for other files, such as intermediate files, target files, etc. generated during compilation, by default in./bin.v2.
–with-
Create and install the specified library
–without-
Do not create and install the specified library, all libraries are created by default
Installation: keyword Install or stage
./bjam Install
Install installs the header file and library file to the appropriate directory, the header file is installed under/usr/local/include, and the library file is installed under/usr/local/lib. Specify the installation directory as shown in./bjam–help.
./bjam Stage
The stage can only be said to be a collection of generated library files into a directory, usually the default is under./stage.
Note:
Install and stage seemingly cannot be used at the same time, the middle will be stuck.
If install or stage is not specified during compilation, the resulting target library file exists only in the directory referred to by –build-dir, and the default is./bin.v2. With this in mind, it is recommended to use the Stage keyword if you do not need to install the header files and library files.
Here are the properties:
Toolset=toolset
Specifies the compiler, which is automatically detected by default, and can be used when multiple compilers are installed.
Variant=debug|release
Specifies that the debug or release version be compiled.
Link=static|shared
Specify to create a static library or a dynamic library
Runtime-link=static|shared
Specifies whether the created library is a static link or a dynamic link to the C Run-time library (or C + + standard library), depending on the type of –link, different compiler-allowed linkage strategies, such as under GCC, when generating a dynamic library (–link=shared), Static linking to the C Runtime library (or C + + standard library) is not allowed.
Threading=single|multi
Specifies that you create a multi-threaded or single-threaded version library.
Properties can be set at the same time, in the following two ways, in order to avoid name collisions, it is recommended to take the Propery=value format:
./bjam Variant=debug,release Stage
Or
./bjam Variant=debug Variant=release
Both of these ways are possible.
Last-executed creation command:
./bjam--with-filesystem--layout=tagged variant=release link=static threading=single stage