1、安装依赖
folly 要求 gcc 5.1+ 版本,以及c++14 编译支持的boost版本 .
folly 的测试代码需要 googletest 库,可以用以下命令下载安装:
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
cmake . && \
make && \
make install
若boost 库或者其他库不是安装的默认路径,可以用CMAKE_LIBRARY_PATH
给cmake添加头文件和库的搜索路径:
cmake \
-DCMAKE_INCLUDE_PATH=/alt/include/path1:/alt/include/path2 \
-DCMAKE_LIBRARY_PATH=/alt/lib/path1:/alt/lib/path2 ...
默认路径直接cmake即可
其他依赖:
sudo apt-get install \
g++ \
cmake \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
libiberty-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
pkg-config \
libunwind-dev
folly还依赖fmt 库,可以用以下命令安装:
git clone https://github.com/fmtlib/fmt.git && cd fmt
mkdir _build && cd _build
cmake ..
make -j$(nproc)
sudo make install
或者用:
sudo apt-get install -y libfmt-dev
2、安装folly
mkdir _build && cd _build
cmake ..
make -j $(nproc)
make install # 可能需要sudo