Bug #80662 Invalid options in mysql_config if -Wno-error used during compile time
Submitted: 8 Mar 2016 20:38 Modified: 9 Jan 2017 10:56
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[8 Mar 2016 20:38] Sveta Smirnova
Description:
If I setup CFLAGS and CXXFLAGS with option -Wno-error=XXX resulting build of mysql_config prints =XXX in --cflags options 

How to repeat:
export CFLAGS="-Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses"
export CXXFLAGS="-Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses"

Build MySQL server

Run mysql_config:

sveta@Thinkie:~/src/sysbench$ /home/sveta/build/mysql-5.7/bin/mysql_config
Usage: /home/sveta/build/mysql-5.7/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/home/sveta/build/mysql-5.7/include =deprecated-declarations =logical-not-parentheses -fabi-version=2 -fno-omit-frame-pointer]
        --cxxflags       [-I/home/sveta/build/mysql-5.7/include =deprecated-declarations =logical-not-parentheses -fabi-version=2 -fno-omit-frame-pointer]

Suggested fix:
Do not print invalid options
[8 Mar 2016 20:38] Sveta Smirnova
Looks like bug #76019 was not fixed properly
[9 Mar 2016 7:52] Umesh Shastry
Hello Sveta,

Thank you for the report.

Thanks,
Umesh
[9 Mar 2016 7:53] Umesh Shastry
-- 5.7.11

[ushastry@fedora23 mysql-5.7.11]$ export CFLAGS="-Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses"
[ushastry@fedora23 mysql-5.7.11]$ export CXXFLAGS="-Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses"

[ushastry@fedora23 mysql-5.7.11]$ cmake . -DWITH_BOOST=./boost/
.
-- Running cmake version 3.4.1
-- Found Git: /usr/bin/git (found version "2.5.0") 
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
..
.
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- INSTALL mysqlclient.pc lib/pkgconfig
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H
-- CMAKE_C_FLAGS: -Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS: -Wno-error=deprecated-declarations -Wno-error=logical-not-parentheses  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ushastry/Downloads/mysql-5.7.11

[ushastry@fedora23 mysql-5.7.11]$ make
.
Scanning dependencies of target mysqltest_embedded
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
[100%] Linking CXX executable mysqltest_embedded
[100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
[100%] Linking CXX executable my_safe_process
[100%] Built target my_safe_process

[ushastry@fedora23 mysql-5.7.11]$ ./scripts/mysql_config 
Usage: ./scripts/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include =deprecated-declarations =logical-not-parentheses -fabi-version=2 -fno-omit-frame-pointer]
        --cxxflags       [-I/usr/local/mysql/include =deprecated-declarations =logical-not-parentheses -fabi-version=2 -fno-omit-frame-pointer]
        --include        [-I/usr/local/mysql/include]
        --libs           [-L/usr/local/mysql/lib -lmysqlclient -lpthread -lm -lrt -ldl]
        --libs_r         [-L/usr/local/mysql/lib -lmysqlclient -lpthread -lm -lrt -ldl]
        --plugindir      [/usr/local/mysql/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [5.7.11]
        --libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lpthread -lm -lrt -lcrypt -ldl]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/local/mysql/include]
                pkglibdir     [/usr/local/mysql/lib]
                plugindir     [/usr/local/mysql/lib/plugin]
[9 Jan 2017 10:53] Terje Røsten
Posted by developer:
 
Fixed by:
 
commit 5ed9c1c52c93b3fb48bd1367b24f40a8fcef9dc3
Author: Tor Didriksen <tor.didriksen@oracle.com>
Date:   Wed Nov 16 14:01:42 2016 +0100

    Bug#25040566 USE WHITELIST INSTEAD OF FILTER FOR MYSQL_CONFIG COMPILE OPTIONS
[9 Jan 2017 16:26] Paul Dubois
Posted by developer:
 
Noted in 5.7.18, 8.0.1 changelogs.

If MySQL was configured to build with the -Wno-error option,
mysql_config produced incorrect output for its --cflags option.