官方說的相關依賴
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
編譯
- 進入folly/build, 我去,發(fā)現(xiàn)了 build_debs_ubuntu_14.04.sh 我的就是ubuntu啊
- 立馬運行 build_debs_ubuntu_14.04.sh, 我機器上boost1.58, 結果
BOOST_VERSION=1.54.0
- 懶得改這個腳本了,想方法直接生成configure文件吧
- 切到folly根目錄次伶,執(zhí)行 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,發(fā)現(xiàn)是沒連接pthread lib, 打開configure文件蝌以,在16553行,
<pre><code>“LIBS="-lglog $LIBS" => "LIBS="-lglog -lpthread $LIBS"</code></pre> - ./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 <pre><code>mkdir build && cd build && cmake ../ && make && sudo make install</code></pre>
- ./configure, 終于成功了:沃8!
- make && sudo make install
總結
- 編譯還好沒什么太難的地方溶推,過程有問題直接看config.log里面的信息徊件,基本上就是需要的庫沒有安裝;
- 大公司間總是惺惺相惜蒜危,folly用了google的庫虱痕。這也驗證了folly不是要從頭打造一個C++11庫,它是std和boost的補充辐赞。