Gramfs安装指南

依赖的库及下载地址

glog    [https://github.com/hb-lee/attachment/glog-0.3.3.tar.gz]
gflag    [https://github.com/gflags/gflags]
kyotocabinet    [https://github.com/hb-lee/attachment/kyotocabinet-1.2.77.tar.gz]
boost_system    [https://github.com/hb-lee/attachment/boost_1_53_0.tar.gz]
boost_serialization    [https://github.com/hb-lee/attachment/boost_1_53_0.tar.gz]
thrift    [https://github.com/hb-lee/attachment/thrift-0.12.0.tar.gz]

cmake安装

wget https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz
tar -xvf cmake-3.14.0.tar.gz
cd cmake-3.14.0.tar.gz
./configure
make && make install
cd -

glog安装

tar -xvf glog-0.3.3.tar.gz
cd glog-0.3.3.tar.gz
./configure
make && make install
cd -

gflag安装

git clone https://github.com/gflags/gflags
cd gflags
cmake .
make -j 24
make install
cd -

kyotocabinet安装

tar xvf kyotocabinet-1.2.77.tar.gz
cd kyotocabinet-1.2.77
./configure
make && make install
cd -

thrift安装

yum -y groupinstall "Development Tools"
sudo yum -y install libevent-devel zlib-devel openssl-devel

openssl-devel若出现依赖导致安装不了,可以用源码包进行安装(提供包openssl-1.1.1b.tar.gz)

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvf autoconf-2.69.tar.gz
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
tar xvf automake-1.14.tar.gz
cd automake-1.14
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz
tar xvf bison-2.5.1.tar.gz
cd bison-2.5.1
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.gz
tar xvf boost_1_53_0.tar.gz
cd boost_1_53_0
./bootstrap.sh
sudo ./b2 install
cd ..

wget http://mirrors.hust.edu.cn/apache/thrift/0.12.0/thrift-0.12.0.tar.gz
tar xvf thrift-0.12.0.tar.gz
cd thrift
./configure --with-lua=no
make
make && make install

遇到的棘手问题

gcc升级问题:

  • g++: fatal error: braced spec is invalid at ‘%’

    env -i PATH=/bin:/usr/bin make [可能试一下环境变量导致的,用此命令来暂时还原最原始的环境变量] 首先得换高阶的gcc

共享库编译问题

  • relocation R_X86_64_32S against `XXXXXXX’ can not be used when making a shared object; recompile with -fPIC

    网上都显示这个问题是由于没有加-fPIC编译选项导致的,但是亲自尝试后并不是这样,加了也报这个错误;后来发现是由于代码里有static函数,共享库里不能有static,自己理解是shared里地址不能固定,而static放在常量区,将static改掉就可以了;