Bug #88553 compile error: format error in xpl_log.h
Submitted: 20 Nov 2017 9:27 Modified: 12 Apr 2018 5:24
Reporter: milly Zhu Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:mysql-8.0.3-rc OS:Ubuntu (Ubuntu-14.04)
Assigned to: CPU Architecture:Any
Tags: compile

[20 Nov 2017 9:27] milly Zhu
Description:
I got errors when I compiled mysql-8.0.3-rc.

[ 77%] Building CXX object rapid/plugin/x/CMakeFiles/mysqlx.dir/src/admin_cmd_handler.cc.o
In file included from /home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc:28:0:
/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc: In function ‘bool xpl::{anonymous}::is_collection(ngs::Sql_session_interface*, const string&, const string&)’:
/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/rapid/plugin/x/src/xpl_log.h:51:100: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
 #define log_debug(...) my_plugin_log_message(&xpl::plugin_handle, MY_INFORMATION_LEVEL, __VA_ARGS__)
                                                                                                    ^
/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc:628:7: note: in expansion of macro ‘log_debug’
       log_debug(
       ^
cc1plus: all warnings being treated as errors
make[2]: *** [rapid/plugin/x/CMakeFiles/mysqlx.dir/src/admin_cmd_handler.cc.o] error 1
make[1]: *** [rapid/plugin/x/CMakeFiles/mysqlx.dir/all] error 2
make: *** [all] error 2

How to repeat:
1. cmake -DCMAKE_INSTALL_PREFIX=/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/install -DMYSQL_DATADIR=/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/home/yancai/Benchmarks/mysql/mysql-8.0.3-rc/myvar/run/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DWITH_BOOST=/home/yancai/Benchmarks/mysql/boost_1_64_0/

2. make

relevant software version:
cmake-3.2.2
gcc-4.8.4
make-3.81

My OS is 32-bit.
[20 Nov 2017 9:28] milly Zhu
cmake information:

-- Running cmake version 3.2.2
-- Configuring with MAX_INDEXES = 64U
-- CMAKE_GENERATOR: Unix Makefiles
-- SIZEOF_VOIDP 4
-- MySQL 8.0.3-rc
-- Packaging as: mysql-8.0.3-rc-Linux-i686
-- Local boost dir /home/yancai/Benchmarks/mysql/boost_1_64_0
-- Found /home/yancai/Benchmarks/mysql/boost_1_64_0/boost/version.hpp 
-- BOOST_VERSION_NUMBER is #define BOOST_VERSION 106400
-- BOOST_INCLUDE_DIR /home/yancai/Benchmarks/mysql/boost_1_64_0
-- NUMA library missing or required version not available
-- WITH_PROTOBUF=bundled
-- PROTOBUF_VERSION_NUMBER is #define GOOGLE_PROTOBUF_VERSION 2006001
-- You need to set WITH_CURL. This variable needs to point to curl library.
-- Performing Test HAVE_Wimplicit-fallthrough=2
-- Performing Test HAVE_Wimplicit-fallthrough=2 - Failed
-- Using cmake version 3.2.2
-- Not building NDB
-- MYSQLX - Text log of protobuf messages enabled
-- MYSQLX - Enabled debug traces
-- Creating LDAP authentication SASL client library.
-- Required SASL header is missing. Skipping the LDAP SASL client authentication plugin.
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
-- CONFIG_CLIENT_LIBS -lpthread -lm -lrt -ldl
-- CONFIG_LIBS_PRIVATE -lpthread -lm -lrt -ldl
-- INSTALL mysqlclient.pc lib/pkgconfig
-- CMAKE_BUILD_TYPE: Debug
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;BOOST_GEOMETRY_SQRT_CHECK_FINITENESS;HAVE_CONFIG_H;RAPIDJSON_NO_SIZETYPEDEFINE;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;_USE_MATH_DEFINES;HAVE_LIBEVENT1
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wmissing-format-attribute -Wundef -Wwrite-strings -Wdeclaration-after-statement -Werror
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wmissing-format-attribute -Wundef -Woverloaded-virtual -Wno-missing-field-initializers -Wlogical-op -Werror
-- CMAKE_C_LINK_FLAGS:  -fuse-ld=gold
-- CMAKE_CXX_LINK_FLAGS:  -fuse-ld=gold
-- CMAKE_C_FLAGS_DEBUG: -fPIC -g -fno-omit-frame-pointer -ffp-contract=off  -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- CMAKE_CXX_FLAGS_DEBUG: -fPIC -g -fno-omit-frame-pointer -std=c++11 -ffp-contract=off  -DENABLED_DEBUG_SYNC -DSAFE_MUTEX
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yancai/Benchmarks/mysql/mysql-8.0.3-rc
[22 Jan 2018 9:26] MySQL Verification Team
Hello milly Zhu,

Thank you for the report.
I'm not seeing this issue at my end with exact provided cmake options on OL7.

If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Thanks,
Umesh
[22 Jan 2018 9:27] MySQL Verification Team
Build details

Attachment: 88553.build (application/octet-stream, text), 451.90 KiB.

[22 Jan 2018 9:54] Alexey Kopytov
Umesh,

The difference between your environment and report's one is 64- vs 32-bit architecture. The reporter says he's on a 32-bit machine (also note SIZEOF_VOIDP 4 in the CMake log), while you were testing it on a 64-bit machne (note SIZEOF_VOIDP 8 in your CMake log).
[22 Jan 2018 10:03] MySQL Verification Team
Thank you, Alexey.
I'll check it on 32bit instance and confirm the same.

Regards,
Umesh
[23 Jan 2018 5:34] MySQL Verification Team
Thank you for the feedback!
On 32bit instance I'm seeing this:

ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ uname -an
Linux ubuntu14-04 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686 GNU/Linux
ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ cmake --version
cmake version 2.8.12.2
ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ 

ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ cmake .. -DCMAKE_INSTALL_PREFIX=/home/ushastry/Downloads/mysql-8.0.3-rc/mybld -DMYSQL_DATADIR=/home/ushastry/Downloads/mysql-8.0.3-rc/mybld/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=../boost
.
.

ushastry@ubuntu14-04:~/Downloads/mysql-8.0.3-rc/mybld$ make -j4
.
.
Scanning dependencies of target mysqlcheck
[ 70%] Building CXX object client/base/CMakeFiles/client_base.dir/__/__/sql-common/sql_string.cc.o
[ 70%] Building CXX object client/CMakeFiles/mysqlcheck.dir/check/mysqlcheck.cc.o
In file included from /home/ushastry/Downloads/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc:28:0:
/home/ushastry/Downloads/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc: In function ‘bool xpl::{anonymous}::is_collection(ngs::Sql_session_interface*, const string&, const string&)’:
/home/ushastry/Downloads/mysql-8.0.3-rc/rapid/plugin/x/src/xpl_log.h:51:100: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
 #define log_debug(...) my_plugin_log_message(&xpl::plugin_handle, MY_INFORMATION_LEVEL, __VA_ARGS__)
                                                                                                    ^
/home/ushastry/Downloads/mysql-8.0.3-rc/rapid/plugin/x/src/admin_cmd_handler.cc:628:7: note: in expansion of macro ‘log_debug’
       log_debug(
       ^
cc1plus: all warnings being treated as errors
make[2]: *** [rapid/plugin/x/CMakeFiles/mysqlx.dir/src/admin_cmd_handler.cc.o] Error 1
make[1]: *** [rapid/plugin/x/CMakeFiles/mysqlx.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 70%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/table_replication_applier_status_by_worker.cc.o
Linking CXX executable ../runtime_output_directory/mysqlcheck
Linking CXX static library libclient_base.a
[ 70%] Built target client_base
[ 70%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/table_replication_group_member_stats.cc.o
[ 70%] Built target mysqlcheck
[ 70%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/table_plugin_table.cc.o
[ 70%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/table_replication_applier_filters.cc.o
[ 70%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/table_replication_applier_global_filters.cc.o
Linking CXX static library libperfschema.a
[ 70%] Built target perfschema
make: *** [all] Error 2
[23 Jan 2018 8:51] milly Zhu
Hi~!

Thank you for your concern.

If you know how to compile successfully on a 32-bit OS, please tell me. Thank you~!
[27 Feb 2018 16:57] Tor Didriksen
Posted by developer:
 
Fixed by patch for:
    Bug#26711839 COMPILE WARNINGS ON MACOS