In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today I will show you how to compile boost in Linux system. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.
The compiling method of Boost on Linux platform
Boost is the Boost library, it is a portable, and bai for source code C++ library, and it as a backup to the standard library, C++ standardization process is one of the development engines.
Instead of using make, which has become an accepted standard, Boost is compiled using a tool bjam (boost jam) developed specifically for Boost.
Take boost1.40 as an example, the programming environment on the Linux platform is gcc4.4.1, assuming that the Boost code is in the / usr/src/boost_1_40_0 directory, the steps are as follows.
\ 1. Get bjam
There are three ways to obtain bjam, as follows:
Methods bjam executable programs precompiled on various platforms are available on the 1:Boost website, which can be downloaded and used directly.
Method 2: compile the executable program from the bjam code provided in the Boost source code.
Method 3: generate bjam through 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 the compilation is complete:
The generated executable file is
# / usr/src/boost_1_40_0/tools/jam/src/bin.linuxx86**/bjam**
You need to copy the 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 generates the bjam file directly under the Boost source code directory.
two。 Modify bjam configuration
Before using bjam, you need to modify the configuration file of bjam. Configuration file for Linux platform:
/ usr/src/boost_1_40_0/tools/build/v2/user-config.jam
The modifications are as follows. Note: it seems normal for the author not to modify it in the experiment.
Remove the comment symbol'# 'before "# using gcc;" in line 43, indicating that gcc compilation is used.
If you want to use STLport as its standard library, remove the'# 'before line 75.
\ 3. Complete compilation of Boost
Complete compilation of Boost to generate static and dynamic libraries for all debuggers and distributions.
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_1_40_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 all compilation of the Linux platform bjam and Boost, and generates static and dynamic libraries for all debugs and distributions. But this method is not recommended.
After the compilation is successful, a number of files will be generated in the / usr/src/boost_1_40_0/bin.v2 directory, including .an and .so.1.40.0 files, which are required to use Boost on the Linux platform, and other files can be deleted.
Installation
#. / bjam install
Install the generated libraries to the / urs/local/lib directory by default.
4-part compilation of Boost
Compiling Boost completely takes time and effort, and not all of these libraries are used in the development process, so bjam also allows users to choose which libraries to compile.
On the basis of full compilation, use the-with or-without option to turn compilation of a library on or off, for example, just compiling the date_ time library:
# cd / usr/src/boost_1_40_0
#. / bjam-toolset=msvc-with-date_time-build-type=complete stage
These are all the contents of how to compile boost in the Linux system. For more content related to how to compile boost in the Linux system, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.