Bug #76019 Compiler options format -Werror=foo not washed from mysql_config
Submitted: 24 Feb 2015 9:09 Modified: 9 Mar 2015 21:21
Reporter: Terje Røsten Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.42 OS:Any
Assigned to: CPU Architecture:Any

[24 Feb 2015 9:09] Terje Røsten
Description:
The output from e.g "mysql_config --cflags" is based on compiler options used to build 
server, server and  client libs.

Some options is washed or removed as 3rd party software might not be as strict as MySQL
regarding errors and warnings.

For example we removed -Werror, -Wall, -O2 and -O3.

Newer gcc versions has added -Werror=format-security, this option is only valid if used 
together with -O1 or higher. As we remove any -Ox format, we must remove 
-Werror=format-security too. In fact it seems most safe to remove any option
on the format -Werror=foo.

How to repeat:
Configure build with e.g.

cmake ..
  -DCMAKE_C_FLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic"
  -DCMAKE_CXX_FLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic"

on Fedora 21 (vitro47) with gcc 4.9.2

Try to compile test app with resulting mysql_config like this:

 gcc -o foo $(mysql_config --cflags) foo.c

Bonus: 

write a mtr or other test to actual test that created mysql_config outputs valid gcc options.
[9 Mar 2015 21:21] Paul DuBois
Noted in 5.6.25, 5.7.7, 5.8.0 changelogs.

Inappropriate -Werror options could appear in mysql_config --cflags
output.