Bug #72353 innodb memcached + -DWITH_LIBEVENT=system is broken

Submitted: 15 Apr 2014 20:38 Modified: 16 Apr 2014 13:31
Reporter: Andrew Garner Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Memcached Severity:S3 (Non-critical)
Version:5.6.17 OS:Linux (rhel 6.5)
Assigned to: CPU Architecture:Any

[15 Apr 2014 20:38] Andrew Garner
Description:
Building MySQL from source and using the cmake options -DWITH_INNODB_MEMCACHED=ON and -DWITH_LIBEVENT=system results in a libmemcached.so that is not linked with libevent.  Attempting to install the daemon_memcached plugin results in an error due to an unresolved symbol.

How to repeat:
Build the source tree with -DWITH_INNODB_MEMCACHED=ON -DWITH_LIBEVENT=system:

## Typical build for RPM
$ mkdir build && cd build
$ cmake .. -DBUILD_CONFIG=mysql_release \
         -DFEATURE_SET="community" \
         -DINSTALL_LAYOUT=RPM \
         -DCMAKE_INSTALL_PREFIX="/usr" \
         -DINSTALL_INCLUDEDIR=include/mysql \
         -DINSTALL_INFODIR=share/info \
         -DINSTALL_LIBDIR="lib64/mysql" \
         -DINSTALL_MANDIR=share/man \
         -DINSTALL_MYSQLSHAREDIR=share/mysql \
         -DINSTALL_MYSQLTESTDIR=share/mysql-test \
         -DINSTALL_PLUGINDIR="lib64/mysql/plugin" \
         -DINSTALL_SBINDIR=libexec \
         -DINSTALL_SCRIPTDIR=bin \
         -DINSTALL_SQLBENCHDIR=share \
         -DINSTALL_SUPPORTFILESDIR=share/mysql \
         -DMYSQL_DATADIR="/var/lib/mysql" \
         -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
         -DENABLED_LOCAL_INFILE=ON \
         -DENABLE_DTRACE=ON \
         -DWITH_EMBEDDED_SERVER=ON \
         -DWITH_EDITLINE=system \
         -DWITH_LIBEVENT=system \
         -DWITH_INNODB_MEMCACHED=ON \
         -DWITH_SSL=system \
         -DWITH_ZLIB=system \
         -DWITH_MYSQLD_LDFLAGS="-Wl,-z,relro,-z,now"

Attempt to install the daemon_memcached plugin per:

https://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-setup.html

mysql> install plugin daemon_memcached soname "libmemcached.so";
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/libmemcached.so' (errno: 2 /usr/lib64/mysql/plugin/libmemcached.so: undefined symbol: event_get_version)

Suggested fix:
The bundled macro sets LIBEVENT_LIBRARY which innodb_memcached/daemon_memcached looks for.   When using "system" LIBEVENT_LIBRARIES is set instead.  I suspect this is just a bug in naming conventions.

With the following changes the correct linking seems to occur and I can successfully install and use the plugin:

--- a/cmake/libevent.cmake
+++ b/cmake/libevent.cmake
@@ -75,7 +75,7 @@ MACRO (MYSQL_CHECK_LIBEVENT)

     IF(LIBEVENT_FOUND)
       SET(LIBEVENT_SOURCES "")
-      SET(LIBEVENT_LIBRARIES ${LIBEVENT_LIBS})
+      SET(LIBEVENT_LIBRARY ${LIBEVENT_LIBS})
       SET(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
       SET(LIBEVENT_DEFINES "-DHAVE_LIBEVENT")
     ELSE()

Rebuilding allows the plugin to install correctly:

mysql> install plugin daemon_memcached soname "libmemcached.so";
Query OK, 0 rows affected (0.00 sec)

And the plugin works as expected:

$ mysql < /usr/share/mysql/innodb_memcached_config.sql

$ nc 127.0.0.1 11222
set a11 10 0 9
123456789
STORED
get a11
VALUE a11 10 9
123456789
END
quit
[16 Apr 2014 13:31] MySQL Verification Team
Hello Andrew,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.