在centos 5.8上编译mysql5.5.32,加了-DWITH_SSL=system参数,编译时报错如下,
/usr/local/src/mysql-5.5.32/vio/viossl.c: In function 'ssl_do':
/usr/local/src/mysql-5.5.32/vio/viossl.c:175: error: 'SSL_OP_NO_COMPRESSION' undeclared (first use in this function)
/usr/local/src/mysql-5.5.32/vio/viossl.c:175: error: (Each undeclared identifier is reported only once
/usr/local/src/mysql-5.5.32/vio/viossl.c:175: error: for each function it appears in.)
make[2]: *** [vio/CMakeFiles/vio.dir/viossl.c.o] Error 1
make[1]: *** [vio/CMakeFiles/vio.dir/all] Error 2
make: *** [all] Error 2
网上查了一下,应该是openssl的版本太低造成的,在centos6上编译就没有这个问题。官方已经给出了解决的patch,内容如下
--- mysql-5.5.32/vio/viossl.c~2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.32/vio/viossl.c2013-04-18 16:58:38.552557538 +0200
@@ -172,8 +172,10 @@
SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
SSL_set_fd(ssl, vio->sd);
#ifndef HAVE_YASSL
+#ifdef SSL_OP_NO_COMPRESSION
SSL_set_options(ssl, SSL_OP_NO_COMPRESSION);
#endif
+#endif
if ((r= connect_accept_func(ssl)) < 1)
{
意思就是说在源码的vio/viossl.c的文件中的相应位置,添加上红色部分的2行,然后重新编译即可。