Folly库编译

官方说的相关依赖

Dependencies
folly requires gcc 4.8+ and a version of boost compiled with C++11 support.
Please download googletest fromhttps://googletest.googlecode.com/files/gtest-1.7.0.zip and unzip it in thefolly/test subdirectory.

开始编译

获取源码

  • git clone https://github.com/facebook/folly.git

编译

  1. 进入folly/build, 我去,发现了 build_debs_ubuntu_14.04.sh 我的就是ubuntu啊
  • 立马运行 build_debs_ubuntu_14.04.sh, 我机器上boost1.58, 结果

BOOST_VERSION=1.54.0

  • 懒得改这个脚本了,想方法直接生成configure文件吧
  • 切到folly根目录,执行 autoreconf -if, 嘿!还真成功了
  • ./configure

说我g-flag库没装

  • 直接 sudo apt-get install libgflags-dev 成功!
  • ./configure

说我glog库没装

  • 直接 sudo apt-get install libgflags-log, 没这个包啊,没这个包 :-(
  • git clone https://github.com/google/glog.git
  • 用cmake编译glog成功
  • 切到folly根目录,./configure, 哪尼啊V_V, 结果:

checking for glog viability... no
configure: error: "libglog invalid, see config.log for details"

  • 查看config.log,发现是没连接pthread lib, 打开configure文件,在16553行,
    “LIBS="-lglog $LIBS" => "LIBS="-lglog -lpthread $LIBS"
  • ./configure, 结果:

checking double-conversion/double-conversion.h usability... no
checking double-conversion/double-conversion.h presence... no
checking for double-conversion/double-conversion.h... no
configure: error: Couldn't find double-conversion.h, please download from https://github.com/google/double-conversion

  • git clone https://github.com/google/double-conversion
  • 用cmake来编译double-conversion
    mkdir build && cd build && cmake ../ && make && sudo make install
  • ./configure, 终于成功了!!!
  • make && sudo make install

总结

  • 编译还好没什么太难的地方,过程有问题直接看config.log里面的信息,基本上就是需要的库没有安装;
  • 大公司间总是惺惺相惜,folly用了google的库。这也验证了folly不是要从头打造一个C++11库,它是std和boost的补充。

你可能感兴趣的:(Folly库编译)