MYSQL PROXY
mysql-proxy-0.8.2
需要事先准备的软件包
libevent
lua5.1.4
libtool
pkg-config
MySQL 5.0.x or higher developer files
glib-2.22.5
[root@oradba lua-5.1.4]# yum list|grep libevent
libevent.i386 1.4.13-1 installed
libevent.x86_64 1.4.13-1 installed
libevent-devel.i386 1.4.13-1 installed
libevent-devel.x86_64 1.4.13-1 installed
[root@oradba mysql-proxy-0.8.2]# yum list|grep libtool
libtool.x86_64 1.5.22-7.el5_4 installed
libtool-ltdl.i386 1.5.22-7.el5_4 installed
libtool-ltdl.x86_64 1.5.22-7.el5_4 installed
libtool-ltdl-devel.i386 1.5.22-7.el5_4 installed
libtool-ltdl-devel.x86_64 1.5.22-7.el5_4 installed
安装lua
# wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
# tar xvfz lua-5.1.4.tar.gz
# cd lua-5.1.4
# vi Makefile
修改为:INSTALL_TOP= /usr/local/lua
编译:
# make linux install
安装glib2
# wget http://ftp.gnome.org/pub/gnome/sources/glib/2.22/glib-2.22.5.tar.gz
# tar xvfz glib-2.22.5.tar.gz
# cd glib-2.22.5
# ./configure --prefix=/usr/local/glib-2.2
# make && make install
否则在编译mysql-proxy时,会报
Requested 'glib-2.0 >= 2.16.0' but version of GLib is 2.12.3
安装pkg-config
#wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz
#tar xvf pkg-config-0.26.tar.gz
#cd pkg-config-0.26
#pkg-config
#cp etc/lua.pc /usr/local/lib/pkgconfig/
安装mysql-proxy-0.8.2
#wget ftp://mysql.cdpa.nsysu.edu.tw/Unix/Database/MySQL/Downloads/MySQL-Proxy/mysql-proxy-0.8.2.tar.gz
#./configure LDFLAGS="-lm -ldl" LUA_CFLAGS="-I/usr/local/lua/include/" LUA_LIBS=/usr/local/lua/lib/liblua.a --prefix=/usr/local/mysql-proxy --with-lua --with-mysql=/usr/local/mysql/bin/mysql_config
成功后:
[root@oradba mysql]# /usr/local/mysql-proxy/bin/mysql-proxy -V
mysql-proxy 0.8.2
chassis: mysql-proxy 0.8.2
glib2: 2.22.5
libevent: 1.4.13-stable
LUA: Lua 5.1.4
package.path: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.lua
package.cpath: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.so
-- modules
proxy: 0.8.2
====================
报错1:
mysql proxy configure: error: mysql.h is required
解决方式:
指定mysql_config位置
由于当时是编译版本的MYSQL,需要指定mysql配置文件位置--with-mysql=/usr/local/mysql/bin/mysql_config
---
报错2
/usr/local/lua/lib/liblua.a: could not read symbols
解决方式:
vim src/Makefile
CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS)
---------
报错3
In file included from /usr/local/include/glib-2.0/glib/galloca.h:34,
from /usr/local/include/glib-2.0/glib.h:32,
from glib-ext.c:22:
/usr/local/include/glib-2.0/glib/gtypes.h:34:24: error: glibconfig.h: No such file or directory
/usr/local/include/glib-2.0/glib/gtypes.h:410:2: error: #error unknown ENDIAN type
In file included from /usr/local/include/glib-2.0/glib.h:33,
from glib-ext.c:22:
解决方式:
cp /usr/local/lib/glib-2.0/include/glibconfig.h /usr/local/include/glib-2.0/
export LUA_CFLAGS="-I /usr/local/lua/include"
export LUA_LIBS="-L /usr/local/lua/lib -llua -ldl"
报错4:
checking for GLIB... configure: error: Package requirements (glib-2.0 >= 2.16.0) were not met:
Requested ¨glib-2.0 >= 2.16.0¨ but version of GLib is 2.12.3
解决方式:
由于编译时没有识别到当前版本,需要更新环境变量
export GLIB_CFLAGS="-I/usr/local/include/glib-2.0"
export GLIB_LIBS="-L/usr/local/lib/glib-2.0"
export GMODULE_CFLAGS="-I/usr/local/include"
export GMODULE_LIBS="-L/usr/local/lib"
export GTHREAD_CFLAGS="-I/usr/local/include"
export GTHREAD_LIBS="-L/usr/local/lib"
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20682026/viewspace-732173/,如需转载,请注明出处,否则将追究法律责任。