mysql升级到5.5版本以后无法编译

转自天空极速的博客 http://www.siutung.org/post/446/

 

在FreeBSD里升级php5-extensions的过程中,出现mysqli无法正常进行编译,错误提示:
===> Building for php5-mysqli-5.2.12_2
/bin/sh /usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/libtool --mode=compile cc -I. -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -DPHP_ATOM_INC -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/include -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/main -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/mysql -DHAVE_CONFIG_H -O2 -pipe -fno-strict-aliasing -c /usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c -o mysqli.lo
mkdir .libs
cc -I. -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -DPHP_ATOM_INC -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/include -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/main -I/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/mysql -DHAVE_CONFIG_H -O2 -pipe -fno-strict-aliasing -c /usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c -fPIC -DPIC -o .libs/mysqli.o
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c: In function 'zm_startup_mysqli':
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: 'MYSQL_RPL_MASTER' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: (Each undeclared identifier is reported only once
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:637: error: for each function it appears in.)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:638: error: 'MYSQL_RPL_SLAVE' undeclared (first use in this function)
/usr/ports/databases/php5-mysqli/work/php-5.2.12/ext/mysqli/mysqli.c:639: error: 'MYSQL_RPL_ADMIN' undeclared (first use in this function)
*** Error code 1
1 error
*** Error code 1

Stop in /usr/ports/databases/php5-mysqli.

===>>> make failed for databases/php5-mysqli
===>>> Aborting update

===>>> Update for databases/php5-mysqli failed
===>>> Aborting update

原因:这是mysql的一个bug,http://bugs.php.net/bug.php?id=46207&edit=1 ,已经提交了。
解决:
修改/usr/local/include/mysql/mysql.h 文件内容:
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
----------------------------==添加的内容开始==-------------------------------------
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
----------------------------==添加的内容结束==--------------------------------------
typedef struct character_set
{
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* collation name */
const char *name; /* character set name */


将以上蓝色的部分内容,添加到mysql.h文件对应的位置,重新编译即可。
NND,害得我差点就重装mysql了。

你可能感兴趣的:(mysql,function,FreeBSD,character,PIVOT,collation)