Bug #59122 5.1.53 build broken on centos 5.2
Submitted: 23 Dec 2010 4:04 Modified: 23 Dec 2010 23:51
Reporter: Mark Callaghan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.1.53 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.53, build, SOURCE

[23 Dec 2010 4:04] Mark Callaghan
Description:
This was not a problem on 5.1.52

This on centos 5.2

cat /etc/redhat-release 
CentOS release 5.2 (Final)

gcc 4.1.2

./configure --with-debug
make
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -g  -DSAFE_MUTEX -g -O2   -DUNIV_LINUX -DUNIV_LINUX -MT term.o -MD -MP -MF .deps/term.Tpo -c -o term.o term.c
cc1: warnings being treated as errors
term.c: In function ‘term_set’:
term.c:946: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:947: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:949: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:950: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:952: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:953: warning: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
term.c:955: warning: passing argument 1 of ‘tgetnum’ discards qualifiers from pointer target type
term.c:956: warning: passing argument 1 of ‘tgetnum’ discards qualifiers from pointer target type
make[2]: *** [term.o] Error 1

How to repeat:
I don't think -Werror was used for 5.1.52 cmd-line-utils/libedit, from one of my 5.1.52 builds

gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include    -g  -DSAFE_MUTEX -g -O2 -fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_purify -DNO_ALARM -DSIGNAL_WITH_VIO_CLOSE -DUNIV_DEBUG_VALGRIND -Wall  -DUNIV_LINUX -MT term.o -MD -MP -MF .deps/term.Tpo -c -o term.o term.c
mv -f .deps/term.Tpo .deps/term.Po
[23 Dec 2010 5:11] MySQL Verification Team
looks like bug #57989
[23 Dec 2010 16:13] Mark Callaghan
We are back to warning spam as these were also added to the build but the numerous warnings that follow were not fixed. And now serious warnings added by new code will get lost from the less serious warnings about unused parameters.

-Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-unused-parameter

With the flags above there are 41300 warnings in my 5.1.53 build
[23 Dec 2010 17:40] Davi Arnaut
This is a bug in system headers that I think we will have to workaround. AFAIK, it builds mostly clean if used properly. For example, a -Wall flag will cancel a previous -Wno-unused-parameter. This will happen if one adds it via CFLAGS/CXXFLAGS and at the same time use the MySQL maintainer mode flags.
[23 Dec 2010 17:48] Mark Callaghan
How do I avoid using maintainer mode? Because of my patches, I run BUILD/autorun.sh
[23 Dec 2010 17:48] Davi Arnaut
--with-debug automatically enables the MySQL maintainer mode.

Also, recent systems will provide a hack for this problem. For example, on OS X:

termcap.h:extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);

Another thing, the fact that the flags leak to readline/libedit is a bug that we do not intended to fix on 5.1. We are not aiming for warning free code in third-party tools that we ship.
[23 Dec 2010 17:51] Davi Arnaut
> How do I avoid using maintainer mode? Because of my patches, I run BUILD/autorun.sh

There is a configure time option. Look at ./configure --help. For example, --with-debug --enable-mysql-maintainer-mode=no should disable it.
[23 Dec 2010 23:51] Sveta Smirnova
Thank you for the report.

Shane is right: this is duplicate of bug #57989