0 .获得boost 源码 并且编译 安装
[jeason@centos7 ~]$ git clone https://gitee.com/add358/boost.git
Cloning into 'boost'...
remote: Enumerating objects: 97421, done.
remote: Total 97421 (delta 0), reused 0 (delta 0), pack-reused 97421
Receiving objects: 100% (97421/97421), 173.74 MiB | 8.07 MiB/s, done.
Resolving deltas: 100% (51972/51972), done.
[jeason@centos7 ~]$ cd boost/
[jeason@centos7 boost]$ git tag
1.71.0
[jeason@centos7 boost]$ git checkout 1.71.0
Note: checking out '1.71.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at ab8d0ff2c... version 1.71.0
[jeason@centos7 boost]$ ls
boost boostcpp.jam boost.png bootstrap.sh index.htm INSTALL libs more rst.css tools
boost-build.jam boost.css bootstrap.bat doc index.html Jamroot LICENSE_1_0.txt README.md status version
[jeason@centos7 boost]$ ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... /usr
Generating Boost.Build configuration in project-config.jam for gcc...
Bootstrapping is done. To build, run:
./b2
To generate header files, run:
./b2 headers
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/
[jeason@centos7 boost]$ ./b2
Performing configuration checks
- default address-model : 64-bit
- default architecture : x86
Building the Boost C++ Libraries.
*********************************************************************************************************
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.8.5/release/link-static/threading-multi/visibility-hidden/instantiate_re2c_lexer.o
gcc.archive bin.v2/libs/wave/build/gcc-4.8.5/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/libboost_wave.a
common.copy /home/jeason/boost/stage/lib/libboost_wave.a
...updated 1380 targets...
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/jeason/boost
The following directory should be added to linker library paths:
/home/jeason/boost/stage/lib
[jeason@centos7 boost]$
[jeason@centos7 boost]$ sudo ./b2 install
Performing configuration checks
- default address-model : 64-bit (cached)
- default architecture : x86 (cached)
- symlinks supported : yes (cached)
- C++11 mutex : no (cached)
- lockfree boost::atomic_flag : yes (cached)
- Boost.Config Feature Check: cxx11_auto_declarations : no (cached)
- Boost.Config Feature Check: cxx11_constexpr : no (cached)
- Boost.Config Feature Check: cxx11_defaulted_functions : no (cached)
- Boost.Config Feature Check: cxx11_final : no (cached)
- Boost.Config Feature Check: cxx11_hdr_mutex : no (cached)
- Boost.Config Feature Check: cxx11_hdr_tuple : no (cached)
- Boost.Config Feature Check: cxx11_lambdas : no (cached)
- Boost.Config Feature Check: cxx11_noexcept : no (cached)
- Boost.Config Feature Check: cxx11_nullptr : no (cached)
- Boost.Config Feature Check: cxx11_rvalue_references : no (cached)
- Boost.Config Feature Check: cxx11_template_aliases : no (cached)
- Boost.Config Feature Check: cxx11_thread_local : no (cached)
- Boost.Config Feature Check: cxx11_variadic_templates : no (cached)
- has_icu builds : yes (cached)
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/csetjmp
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/csignal
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cmath
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/clocale
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/climits
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cfloat
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cerrno
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cctype
common.copy /usr/local/include/boost/compatibility/cpp_c_headers/cassert
...updated 16211 targets...
1. 简单的测试
#include <boost/timer/timer.hpp>
#include <iostream>
using namespace boost;
int main()
{
timer t;
std::cout << t.elapsed_max() <<std::endl;
return 0;
}
[jeason@centos7 ~]$ g++ test.cpp
In file included from test.cpp:1:0:
/usr/local/include/boost/timer.hpp:21:98: note:
BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )
[jeason@centos7 ~]$ ./a.out
9.22337e+12
[jeason@centos7 ~]$ rm a.out
|