本文记录了tfs 2.2.16版本在centos linux 6.3 64位系统上的编译安装过程。Tfs编译安装官方推荐使用gcc 4.1.2, centos6.3系统自带的gcc版本为4.4.6,因而在make过程中会报错,主要原因是gcc 4.4.6版本的编译器对语法检查严格导致的。目前tfs版本最新源码为2.6.6,2.6版本的编译安装需要tair支持,支持重复文件的去重。目前淘宝推荐开源用户采用2.2.16版本。
一:安装基本的类库
# yum -y install libuuid-devel zlib-devel mysql-devel # cd /usr/local/src/ # svn checkout -r 18 http://code.taobao.org/svn/tb-common-utils/trunk/ tb-common-utils # export TBLIB_ROOT=/usr/local/lib/ # cd tb-common-utils # sh build.sh # wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz # tar -zxvpf libunwind-0.99.tar.gz # cd libunwind-0.99 # ./configure && make && make install # wget https://gperftools.googlecode.com/files/google-perftools-1.7.tar.gz # tar -zxvpf google-perftools-1.7.tar.gz # cd google-perftools-1.7 # ./configure && make && make install
二:编译安装tfs
# cd /usr/local/src/ # svn co http://code.taobao.org/svn/tfs/tags/release-2.2.16 # cd release-2.2.16/ # ./build.sh init # ./configure --prefix=/usr/local/tfs --with-release=yes # make # make install # ls /usr/local/tfs/ bin conf include lib logs scripts sql
三:make常见报错处理
############################################################################## make报错: session_util.h:30: error: ISO C++ forbids declaration of ‘int32_t’ with no type # vi ./src/common/session_util.h 第一行添加如下: #include <stdint.h> ############################################################################## make报错: /usr/bin/ld: cannot find -ljemalloc collect2: ld returned 1 exit status make[2]: *** [dataserver] Error 1 # wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/abustany:/epel-rebuilds/CentOS_CentOS-6/x86_64/jemalloc-3.4.0-1.1.x86_64.rpm # wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/abustany:/epel-rebuilds/CentOS_CentOS-6/x86_64/jemalloc-devel-3.4.0-1.1.x86_64.rpm # rpm -ivh jemalloc-* ############################################################################## make报错: meta_server_service.cpp:1584: error: invalid conversion from ‘const char*’ to ‘char*’ # vi ./src/name_meta_server/meta_server_service.cpp 1584行修改如下: char* pos = (char *) strstr(sub_dir, parents_dir); ##############################################################################