10/16/13

mysql-proxy 安装记录

1、tar zxvf mysql-proxy-0.8.3.tar.gz
2、cd mysql-proxy-0.8.3
3、./configure –prefix=/opt/phpdba/mysql-proxy
configure: error: mysql_config is not found, use $ ./configure –with-mysql=/path/to/mysql_config【mysql 安装没配置系统环境变量】
4、 ./configure –prefix=/opt/phpdba/mysql-proxy –with-mysql=/opt/phpdba/mysql/bin/mysql_config
checking for LUA… no
… checked for Lua via pkg-config: No package ‘lua’ found. retrying with lua5.1
checking for LUA… no
configure: error: checked for Lua via pkg-config: No package ‘lua5.1′ found. Make sure lua and its devel-package, which includes the lua5.1.pc (debian and friends) or lua.pc (all others) file, is installed
5、安装lua 5.1
tar zxvf lua-5.1.5.tar.gz
cd lua-5.1.5
make linux
在包含自 lua.h:16 的文件中,
从 lua.c:15:
luaconf.h:275:31: 错误:readline/readline.h:没有那个文件或目录
luaconf.h:276:30: 错误:readline/history.h:没有那个文件或目录
lua.c: 在函数‘pushline’中:
lua.c:182: 警告:隐式声明函数‘readline’
lua.c:182: 警告:赋值时将整数赋给指针,未作类型转换
lua.c: 在函数‘loadline’中:
lua.c:210: 警告:隐式声明函数‘add_history’

yum -y install readline
yum -y install readline-devel
make linux
make linux install
6、重新编译mysql-proxy
checking for LUA… no
… checked for Lua via pkg-config: No package ‘lua’ found. retrying with lua5.1
checking for LUA… no
configure: error: checked for Lua via pkg-config: No package ‘lua5.1′ found. Make sure lua and its devel-package, which includes the lua5.1.pc (debian and friends) or lua.pc (all others) file, is installed

export LUA_CFLAGS=”-I/usr/local/include”
export LUA_LIBS=”-L/usr/local/lib -llua -ldl”
7、make
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblua.a: could not read symbols: Bad value
8、重新编译lua

make clean
cd src/

修改Makefile 中CFLAGS 添加 -fPIC

9、cd mysql-proxy-0.8.3 ;make
./.libs/libmysql-chassis.so: undefined reference to `sqrt’
./.libs/libmysql-chassis.so: undefined reference to `floor’
./.libs/libmysql-chassis.so: undefined reference to `ceil’
./.libs/libmysql-chassis.so: undefined reference to `cosh’
./.libs/libmysql-chassis.so: undefined reference to `tan’
./.libs/libmysql-chassis.so: undefined reference to `tanh’
./.libs/libmysql-chassis.so: undefined reference to `asin’
./.libs/libmysql-chassis.so: undefined reference to `log’
./.libs/libmysql-chassis.so: undefined reference to `atan’
./.libs/libmysql-chassis.so: undefined reference to `sinh’
./.libs/libmysql-chassis.so: undefined reference to `fmod’
./.libs/libmysql-chassis.so: undefined reference to `acos’
./.libs/libmysql-chassis.so: undefined reference to `exp’
./.libs/libmysql-chassis.so: undefined reference to `sin’
./.libs/libmysql-chassis.so: undefined reference to `pow’
./.libs/libmysql-chassis.so: undefined reference to `atan2′
./.libs/libmysql-chassis.so: undefined reference to `cos’
./.libs/libmysql-chassis.so: undefined reference to `log10′

10、重新编译
./configure –prefix=/opt/phpdba/mysql-proxy –with-mysql=/opt/phpdba/mysql/bin/mysql_config CFLAGS=-g LIBS=-lm
make && make install
安装成功!