[MDEV-7028] mysql_config produces invalid cflags (was: udf_example.c couldn't compile) Created: 2014-11-05 Updated: 2015-01-06 Resolved: 2014-11-19 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 5.5, 10.0 |
| Fix Version/s: | 5.5.41, 10.0.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Mikhail Gavrilov | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fedora 21 |
||
| Description |
|
|
| Comments |
| Comment by Mikhail Gavrilov [ 2014-11-05 ] |
|
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 |
| Comment by Jan Stanek [ 2014-11-06 ] |
|
The problem seems to originate in the way the mysql_config script is created during mariadb configuration and how it actually produces the --cflags output. When building the mariadb on Fedora, the CFLAGS used in building include '-Wall' and '-Werror=format-security' flags, and the script picks them up and records them correctly. However, when eventually asked for them (by executing it with --cflags option or similar), it does some preprocessing on the recorded 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). Should the mysql_config script also remove the '-Werror=...' and similar options, or should a way be found to leave this flag in place in order to report the build flags as accurately as posible? |
| Comment by Sergei Golubchik [ 2014-11-16 ] |
|
As it already removes all -W... flags, I think it should remove -Werror=... too. The purpose of mysql_config is to produce flags that are required for building with libmysqlclient. Consequently, it should not include flags that make the application better, safer, faster, less buggy, more secure or anything. |
| Comment by Jan Stanek [ 2014-11-20 ] |
|
Thanks for clarification. Since you marked this issue as fixed, can I ask for link to the fix on launchpad? Thanks in advance. |
| Comment by Sergei Golubchik [ 2014-11-20 ] |
|
http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4360 |
| Comment by Tommi Mäkitalo [ 2015-01-04 ] |
|
Hi, I have a problem with another flag in mysql_config --cflags: "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1". The file can't be found on my system (fedora 21) and hence compiling my mysql client software fails to build. I get: g++: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory It may well be, that the file can be found in some package but there should be a dependency then. |
| Comment by Sergei Golubchik [ 2015-01-06 ] |
|
perhaps you have fedora-built packages? We don't have this flag in our rpm packages, as far as I know. |