一、获取安装包
下载地址:http://sourceforge.net/projects/sysbench/
二、编译安装
我的环境为centos 6.4 + MySQL 5.5.30,
复制代码 代码如下:
[root@slave mysqlbak]# tar -xvf sysbench-0.4.12.tar
[root@slave mysqlbak]# cd sysbench-0.4.12
[root@slave mysqlbak]# ./autogen.sh
[root@slave mysqlbak]# ./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib && make && make install
因为我的MySQL是编译安装的,所以上面需要给出MySQL的库文件位置(对应—with—mysql-includes和–with-mysql-libs选项)。
安装过程中常见的报错如下:
复制代码 代码如下:
../libtool: line 841: X--tag=CC: command not found
../libtool: line 874: libtool: ignoring unknown tag : command not found
../libtool: line 841: X--mode=link: command not found
../libtool: line 1007: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1008: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 2234: X-g: command not found
../libtool: line 2234: X-O2: command not found
../libtool: line 1954: X-L/app/programs/mysql/lib: No such file or directory
../libtool: line 2403: Xsysbench: command not found
../libtool: line 2408: X: command not found
../libtool: line 2415: Xsysbench: command not found
../libtool: line 2550: X-lmysqlclient_r: command not found
../libtool: line 2550: X-lrt: command not found
../libtool: line 2550: X-lm: command not found
../libtool: line 2632: X-L/database/mysqlbak/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2550: X-lmysqlclient_r: command not found
../libtool: line 2550: X-lrt: command not found
../libtool: line 2550: X-lm: command not found
../libtool: line 2632: X-L/database/mysqlbak/sysbench-0.4.12/sysbench: No such file or directory
../libtool: line 2550: X-lmysqlclient_r: command not found
../libtool: line 2550: X-lrt: command not found
../libtool: line 2550: X-lm: command not found
一般情况下,遇见问题我们只需要在编译操作前执行sysbench解压目录下的autogen.sh脚本即可;执行该脚本还是报该错误,原因是sysbench自带的libtool有问题,比较它和/usr/bin/libtool文件的区别得知,通过替换这个libtool文件来解决,或者修改aclocal.m4文件的如下内容
复制代码 代码如下:
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
将LIBTOOL变量的'$(SHELL) $(top_builddir)/libtool'修改为:'$(SHELL) /usr/bin/libtool',即使用系统的libtool工具包。
重新安装
[root@slave mysqlbak]# make && make install