Bug #91914 Mysql 5.7.23 cmake fail with 'Unknown CMake command "ADD_COMPILE_FLAGS".'
Submitted: 7 Aug 8:53 Modified: 14 Aug 18:01
Reporter: Tomasz Kłoczko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.7.23 OS:Fedora (rawhide)
Assigned to: CPU Architecture:Any

[7 Aug 8:53] Tomasz Kłoczko
Description:
I'm trying to build MySQL 5.7.23 and it fails on cmake.

At some point cmake fails with:

-- protobuf version is 2.6
-- You need to set WITH_CURL. This variable needs to point to curl library.
-- Performing Test HAVE_SYS_THREAD_SELFID
-- Performing Test HAVE_SYS_THREAD_SELFID - Failed
-- Performing Test HAVE_SYS_GETTID
-- Performing Test HAVE_SYS_GETTID - Success
-- Performing Test HAVE_PTHREAD_SETNAME_NP
-- Performing Test HAVE_PTHREAD_SETNAME_NP - Failed
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Performing Test HAVE_INTEGER_PTHREAD_SELF
-- Performing Test HAVE_INTEGER_PTHREAD_SELF - Success
-- Performing Test HAVE_IMPLICIT_FALLTHROUGH
-- Performing Test HAVE_IMPLICIT_FALLTHROUGH - Success
-- Performing Test HAVE_STRINGOP_TRUNCATION
-- Performing Test HAVE_STRINGOP_TRUNCATION - Success
CMake Error at regex/CMakeLists.txt:20 (ADD_COMPILE_FLAGS):
  Unknown CMake command "ADD_COMPILE_FLAGS".

-- Configuring incomplete, errors occurred!
See also "/home/tkloczko/rpmbuild/BUILD/mysql-5.7.23/build/CMakeFiles/CMakeOutput.log".
See also "/home/tkloczko/rpmbuild/BUILD/mysql-5.7.23/build/CMakeFiles/CMakeError.log".
error: Bad exit status from /var/tmp/rpm-tmp.MeY1OJ (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.MeY1OJ (%build)

How to repeat:
Here are my cmake options:

+ /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON .. -DBUILD_CONFIG=mysql_release '-DCMAKE_C_FLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' '-DCMAKE_CXX_FLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DDAEMON_NAME=mysqld -DDAEMON_NO_PREFIX=mysqld -DENABLED_LOCAL_INFILE=ON -DENABLE_DTRACE=ON -DFEATURE_SET=community -DINSTALL_DOCDIR=share/doc/community-mysql -DINSTALL_DOCREADMEDIR=share/doc/community-mysql -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_INFODIR=share/info -DINSTALL_LAYOUT=RPM -DINSTALL_LIBDIR=lib64/mysql -DINSTALL_MANDIR=share/man -DINSTALL_MYSQLSHAREDIR=share/community-mysql -DINSTALL_MYSQLTESTDIR=share/mysql-test -DINSTALL_PLUGINDIR=lib64/mysql/plugin -DINSTALL_SBINDIR=libexec -DINSTALL_SCRIPTDIR=bin -DINSTALL_SUPPORTFILESDIR=share/community-mysql -DLOG_LOCATION=/var/log/mysqld.log -DMYSQL_DATADIR=/var/lib/mysql -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DNICE_PROJECT_NAME=MySQL -DPID_FILE_DIR=/run/mysqld -DSYSCONF2DIR=/etc/my.cnf.d -DSYSCONFDIR=/etc -DSYSTEMD_PID_DIR=/run/mysqld -DSYSTEMD_SERVICE_NAME=mysqld -DWITH_LIBEVENT=system -DWITH_BOOST=../boost -DWITH_EDITLINE=system -DWITH_EMBEDDED_SERVER=ON -DWITH_EMBEDDED_SHARED_LIBRARY=ON -DWITH_INNODB_MEMCACHED=ON -DWITH_LIBEVENT=system -DWITH_LZ4=system -DWITH_MECAB=system -DWITH_SSL=system -DWITH_SYSTEMD=1 -DWITH_ZLIB=system -DWITH_NUMA=ON -DTMPDIR=/var/tmp
[8 Aug 7:11] Umesh Shastry
Hello Tomasz,

Thank you for the report and feedback.

regards,
Umesh
[8 Aug 20:35] Tomasz Kłoczko
Just in case ..

I found this issue on reuse build procedure implemented in rpm spec file.
Exactly the same set of cmake options works without issues with 5.7.22 source dist tar ball.
[14 Aug 6:34] Tor Didriksen
Posted by developer:
 
fails with gcc-8, when misc libraries are set to "system"

-DCMAKE_C_COMPILER=/usr/bin/gcc-8 -DCMAKE_CXX_COMPILER=/usr/bin/g++-8 -DWITH_SSL=system -DMYSQL_MAINTAINER_MODE=1  -DWITH_LIBEVENT=system -DWITH_EDITLINE=system -DWITH_INNODB_MEMCACHED=ON -DWITH_LIBEVENT=system -DWITH_LZ4=system -DWITH_SSL=system -DWITH_SYSTEMD=1 -DWITH_ZLIB=system 

CMake Error at regex/CMakeLists.txt:22 (ADD_COMPILE_FLAGS):
  Unknown CMake command "ADD_COMPILE_FLAGS".
[14 Aug 18:01] Paul Dubois
Posted by developer:
 
Fixed in 5.7.24, 8.0.13.

Compilation failed for GCC 8 with MySQL configured to use some system
libraries.