Description of problem: [mikhail@localhost udf]$ ls -la total 36 drwxrwxr-x. 1 mikhail mikhail 26 ноя 5 23:02 . drwxrwxr-x. 1 mikhail mikhail 5816 ноя 5 22:42 .. -rw-r--r--. 1 mikhail mikhail 33593 сен 25 04:29 udf_example.c [mikhail@localhost udf]$ mysql_config --cflags -I/usr/include/mysql -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -fno-delete-null-pointer-checks -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing [mikhail@localhost udf]$ gcc $(mysql_config --cflags) -shared -fPIC -o udf_example.so udf_example.c cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security] In file included from /usr/include/pthread.h:21:0, from /usr/include/mysql/my_global.h:294, from udf_example.c:128: /usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ cc1: some warnings being treated as errors
If I am manually remove -Werror=format-security parameter compile would be successful $ gcc -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -fno-delete-null-pointer-checks -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -shared -fPIC -o udf_example.so udf_example.c
The problem seems to originate in the way the mysql_config scripts is created during mariadb configuration and how it actually produces the --cflags output. When the cmake scripts are run in the specfile, the mysql_config picks up actual CFLAGS environment variable and uses it as a base for reporting. However, when actually asked for the CFLAGS (by executing it with --cflags option or similar), it does some preprocessing on the saved values - including removing warning-related flags. The regexp ('-W[-A-Za-z]*') catches (and thus removes) the -Wall options (which "include" -Wformat), but not the -Werror=format-security (which *needs* -Wformat specified in one way or another). The regexp should definitely be fixed, the question is how -- should it also remove the -Werror=format-security, or should it leave the -Wall option in order to get the aforementioned option to work? Guessing from the way the script is written, I think that the -Werror... should be removed as well as the others and leave the decision about compiler warnings and errors to the end user. I will contact upstream and hope for feedback.
Created attachment 959298 [details] Upstream patch
Upstream fixed this issue and it should be shipped with the next release of mariadb 5.5. The fix is accesible at [1] and the Mariadb bug with commentary on this issue is at [2]. For the time being, I am going to apply the patch to current MariaDB, which should fix the issue until next upstream release. [1] http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4360 [2] https://mariadb.atlassian.net/browse/MDEV-7028
mariadb-10.0.14-8.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/mariadb-10.0.14-8.fc21
Package mariadb-10.0.14-8.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing mariadb-10.0.14-8.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-15761/mariadb-10.0.14-8.fc21 then log in and leave karma (feedback).
mariadb-10.0.14-8.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.