centos 6.5 编译 安装 folly指南

来源:互联网 发布:什么软件买东西便宜 编辑:程序博客网 时间:2024/05/27 12:22
一、环境:
系统版本:centos 6.5 64位
gcc版本:4.4.7-4

二、准备工作
1、boost 库 (1.5.1以上版本)
下载地址:https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
2、folly库
git地址:https://github.com/facebook/folly.git
3、gcc新版(支持C++11)
下载地址:http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
4、gflags
下载地址:https://github.com/gflags/gflags/archive/v2.2.0.tar.gz
5、gtest
下载地址:https://github.com/google/googletest/archive/release-1.8.0.tar.gz
6、double-conversion
git地址:https://github.com/google/double-conversion.git
7 、安装依赖包
yum install libevent libevent-devel libtool gitglibc-develglibc-headers gcc-c++ cmake zlib-develibbz2-devel python-developenssl openssl-devel
8、glog
下载地址:https://github.com/google/glog/archive/v0.3.5.tar.gz
9、autoconf
下载地址:ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

三、开始编译
1、先升级gcc版本让其支持C++11标准
(1)执行脚本
执行脚本 ./contrib/download_prerequisites 
(2).建立一个目录供编译出的文件存放
mkdir build
cd build
(3). 生成Makefile文件
../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
(4).编译
make -j4
(5).安装
make install
(6)验证
gcc --version
g++ --version
(7)覆盖原有的libstdc++.so.6
rm -rf /usr/lib64/libstdc++.so.6
ln -s /usr/local/lib64/libstdc++.so.6.0.20 / usr/lib64/libstdc++.so.6

2.编译boost库
(1)、执行脚本
sh bootstrap.sh
(2).进行编译
./b2
(3)、安装
./b2 install

3、编译gflags
(1)cmake mkdir build && cd build
ccmake ..
- Press 'c' to configure the build system and 'e' to ignore warnings.
-Set CMAKE_INSTALL_PREFIX - Set BUILD_SHARED_LIBS ON
- Continue pressing 'c' until the option 'g' is available.
- Then press 'g' to generate the configuration files for GNU Make.
(2)make && make install
(3)设置LD_LIBRARY_PATH不然会找不到动态库
4、编译doubel-conversion
(1)cmake . -DBUILD_TESTING=ON
(2)make && make install

5、编译glog
(1)./configure
(2)make && make install

6、升级autoconf
(1)./configure --prefix=/usr
(2)make && make install

7、编译folly
(1)把googletest 放入folly/folly/test/并重命名为gtest
(2)autoreconf -ivf
(3)./configure
(4)make
(5)make check
(6)make install

报错:Boost::Context Could not find a version of the library!
与yum 安装的boost 冲突,yum remove boost 然后重新编译安装boost