memaslap的安装方法

来源:互联网 发布:windows过期如何激活 编辑:程序博客网 时间:2024/04/24 08:46

前言:

memcache自带的memslap功能无法满足性能测试需要。google以后找到了更为强大的工具memaslap(没错就是多了一个“a”)。

具体功能见:http://docs.libmemcached.org/bin/memaslap.html

但是在安装过程中不断碰壁,于是将安装过程记录如下

 

Step1:下载安装包

memaslap是 libmemcached的一个组件,因此需要编译安装。首先需要下载libmemcached。

下载地址:https://launchpad.net/libmemcached/+download

 

Step2:解压编译

./configure --enable-memaslap

make (这个时候问题来了,遇到以下报错)

报错信息
In file included from ./libmemcached/common.h:92,                 from libmemcached/allocators.cc:38:./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directory  CXX libmemcached/libmemcached_libmemcached_la-backtrace.loIn file included from ./libmemcached/common.h:92,                 from libmemcached/analyze.cc:1:./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directorymake[1]: *** [libmemcached/libmemcached_libmemcached_la-allocators.lo] Error 1make[1]: *** Waiting for unfinished jobs....In file included from ./libmemcached/common.h:92,                 from libmemcached/auto.cc:38:./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directorymake[1]: *** [libmemcached/libmemcached_libmemcached_la-analyze.lo] Error 1In file included from ./libmemcached/common.h:92,                 from libmemcached/backtrace.cc:38:./libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directorymake[1]: *** [libmemcached/libmemcached_libmemcached_la-backtrace.lo] Error 1make[1]: *** [libmemcached/libmemcached_libmemcached_la-auto.lo] Error 1make[1]: Leaving directory `/home/rack/ben/libmemcache/libmemcached-1.0.13'make: *** [all] Error 2

关键信息:error: tr1/cinttypes: No such file or directory

报错原因:libmemcached需要 gcc 4.2 以上版本才可编译,而centos 5.4 的gcc版本只有4.1 ,详见:https://bugs.launchpad.net/libmemcached/+bug/1076181

解决方法:安装gcc44的扩展包,详见:http://gearman.info/build/centos5-8.html

解决步骤引用如下:

wget http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
yum -y -q install boost141-devel
ln -s /usr/include/boost141/boost/ /usr/include/boost
export LDFLAGS="-L/usr/lib64/boost141"
export LD_LIBRARY_PATH=/usr/lib64/boost141:$LD_LIBRARY_PATH
yum -y -q install e2fsprogs-devel e2fsprogs
yum -y -q install gcc44 gcc44-c++
export CC="gcc44"
export CXX="g++44"

 所有操作完成后,重新执行:

./configure --enable-memaslap && make && make install

安装完成!!

 

 

 

 

 

 

 

 

 

 


<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>