Description:
If we build MySQL 5.7.31 from source, MySQL occurs a below error.
In file included from /<<PKGBUILDDIR>>/./mysql-5.7.31/libbinlogevents/include/table_id.h:31:0,
from /<<PKGBUILDDIR>>/./mysql-5.7.31/sql/table.h:37,
from /<<PKGBUILDDIR>>/./mysql-5.7.31/sql/field.h:37,
from /<<PKGBUILDDIR>>/./mysql-5.7.31/sql/protocol_classic.h:27,
from /<<PKGBUILDDIR>>/./mysql-5.7.31/sql/sql_class.h:40,
from ../mrn_mysql.h:58,
from mrn_path_mapper.cpp:22:
/<<PKGBUILDDIR>>/./mysql-5.7.31/libbinlogevents/include/wrapper_functions.h:35:10: fatal error: binlog_config.h: No such file or directory
#include "binlog_config.h"
^~~~~~~~~~~~~~~~~
This error occurs when the libevent-dev package doesn't install in our system.
CMake options when we build are as below.
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_CONFIG=mysql_release \
-DWITH_LIBWRAP=ON \
-DWITH_ZLIB=system \
-DWITH_LZ4=system \
-DWITH_EDITLINE=system \
-DWITH_LIBEVENT=system \
-DWITH_BOOST=../boost \
-DCOMPILATION_COMMENT="(Ubuntu)" \
-DMYSQL_SERVER_SUFFIX="-0ubuntu0.18.04.1" \
-DINSTALL_LAYOUT=DEB \
-DINSTALL_DOCDIR=share/mysql/docs \
-DINSTALL_DOCREADMEDIR=share/mysql \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_INFODIR=share/mysql/docs \
-DINSTALL_LIBDIR=lib/x86_64-linux-gnu \
-DINSTALL_MANDIR=share/man \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_MYSQLTESTDIR=lib/mysql-test \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_SBINDIR=sbin \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DSYSCONFDIR=/etc/mysql \
-DWITH_EMBEDDED_SERVER=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
-DWITH_FEDERATED_STORAGE_ENGINE=ON \
-DWITH_INNODB_MEMCACHED=1 \
-DWITH_EXTRA_CHARSETS=all ..'
We specify "system" in "-DWITH_EDITLINE" option.
However, the reference manual is explained as below about if we specify "system" in "-DWITH_EDITLINE".
"If the system library is not found, the bundled libevent library is used."
https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html#option_cmake_wit...
In fact, If the system library is not found, the bundled libevent library isn't used.
We also understand from the following source code that the bundled libevent library isn't used.
https://github.com/mysql/mysql-server/blob/5.7/cmake/libevent.cmake#L116-L125
Is this a bug? Or are we just not updating the reference manual?
This modification is pushed by the following commit.
https://github.com/mysql/mysql-server/commit/4b17b700a97d5baf8a9f9fba3fd362c6a44f4458
The above commit includes the following commit.
https://github.com/mysql/mysql-server/commit/c3263859219f54cce9153d9cb550e2158ddcf816
How to repeat:
1.
wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/mysql-5.7_5.7.31.orig.tar.gz
2.
tar -zxvf mysql-5.7_5.7.31.orig.tar.gz
3.
cd mysql-5.7.31
4.
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_CONFIG=mysql_release \
-DWITH_LIBWRAP=ON \
-DWITH_ZLIB=system \
-DWITH_LZ4=system \
-DWITH_EDITLINE=system \
-DWITH_LIBEVENT=system \
-DWITH_BOOST=../boost \
-DCOMPILATION_COMMENT="(Ubuntu)" \
-DMYSQL_SERVER_SUFFIX="-0ubuntu0.18.04.1" \
-DINSTALL_LAYOUT=DEB \
-DINSTALL_DOCDIR=share/mysql/docs \
-DINSTALL_DOCREADMEDIR=share/mysql \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_INFODIR=share/mysql/docs \
-DINSTALL_LIBDIR=lib/x86_64-linux-gnu \
-DINSTALL_MANDIR=share/man \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_MYSQLTESTDIR=lib/mysql-test \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_SBINDIR=sbin \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DSYSCONFDIR=/etc/mysql \
-DWITH_EMBEDDED_SERVER=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
-DWITH_FEDERATED_STORAGE_ENGINE=ON \
-DWITH_INNODB_MEMCACHED=1 \
-DWITH_EXTRA_CHARSETS=all .
Suggested fix:
We suggest that we use "MYSQL_USE_BUNDLED_LIBEVENT" as below.
IF(WITH_LIBEVENT STREQUAL "bundled")
MYSQL_USE_BUNDLED_LIBEVENT()
ELSEIF(WITH_LIBEVENT STREQUAL "system")
FIND_SYSTEM_LIBEVENT()
IF(NOT LIBEVENT_FOUND)
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for libevent. Use bundled libevent")
MYSQL_USE_BUNDLED_LIBEVENT()
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "WITH_LIBEVENT must be bundled or system")
ENDIF()