Bug #57991 Compiler flag change build error : adler32.c
Submitted: 4 Nov 2010 19:30 Modified: 22 Dec 2010 19:09
Reporter: Karen Langford Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.53 OS:Linux
Assigned to: Davi Arnaut CPU Architecture:Any

[4 Nov 2010 19:30] Karen Langford
Description:
Change of compiler flag has led to the following build failure on host/platforms:

rhas4-ia64 / rhel4-ia64 
rhel5-ia64-a / rhel5-ia64 
rx2620c /rhel3-ia64 
sles10-ia64-a / sles10-ia64 
sles9-ia64 / sles9-ia64 

make[1]: Entering directory `/data0/mysqldev/my/tmp-201011011924-5.1.53-5224/rpm/BUILD/mysql-5.1.53/zlib'
/bin/sh ../libtool --preserve-dup-deps --tag=CC   --mode=compile icc -static-intel -static-libgcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -g  -DSAFE_MUTEX -g -mp -restrict -no-ftz -no-prefetch   -DUNIV_LINUX -MT adler32.lo -MD -MP -MF .deps/adler32.Tpo -c -o adler32.lo adler32.c
libtool: compile:  icc -static-intel -static-libgcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -g -DSAFE_MUTEX -g -mp -restrict -no-ftz -no-prefetch -DUNIV_LINUX -MT adler32.lo -MD -MP -MF .deps/adler32.Tpo -c adler32.c  -fPIC -DPIC -o adler32.o
icc: command line warning #10156: ignoring option '-W'; no argument required
icc: command line warning #10156: ignoring option '-W'; no argument required
adler32.c(58): error #310: old-style parameter list (anachronism)
      uLong adler;
            ^

adler32.c(59): error #310: old-style parameter list (anachronism)
      const Bytef *buf;
                   ^

adler32.c(60): error #310: old-style parameter list (anachronism)
      uInt len;
           ^

adler32.c(129): error #310: old-style parameter list (anachronism)
      uLong adler1;
            ^

adler32.c(130): error #310: old-style parameter list (anachronism)
      uLong adler2;
            ^

adler32.c(131): error #310: old-style parameter list (anachronism)
      z_off_t len2;
              ^

compilation aborted for adler32.c (code 2)
make[1]: *** [adler32.lo] Error 1

How to repeat:
Build 5.1.53 without flag --enable-mysql-maintainer-mode=no
[25 Nov 2010 12:45] Heinz Bast
I ran into a the identical, underlying issue too when I tried to compile release 5.1.53 using the Intel compiler 12.0. But for me, it happens first for source file  vi_mode.c in cmd_line_utils/readline: 

icc: command line warning #10006: ignoring unknown option '-Wextra'
vi_mode.c(84): error #593: variable "vi_continued_command" was set but never used
  static int vi_continued_command;
compilation aborted for vi_mode.c (code 2)
make: *** [vi_mode.o] Error 2
             ^

I root-caused the problem a litte bit: Different from previous version of the 'configure' script, the new one of release 5.1.53 defines the flags AM_CFLAGS and AM_CXXFAGS which are added to the COMPILE and LINK step.  These flags include the compiler option -Werror which causes all warnings to be treated as errors. However the Intel compiler in some cases issues warnings  - like the ones reported by Karen and as in my sample - where gcc does not. This cause the compilation to fail for the Intel compiler. The -Werror switch could be used for the Intel compiler only after a lot of source code changes would have been done on the MySQL code - which very likely is not realistic.  

I believe this has to be fixed in 'configure'. In case you search for 'icc' in this script, you will see, that there is already an icc-specific modification for -Werror. 

A temporary workaround is calling 'make' with the above variables being reset to an empty definition like:
" make AM_CFLAGS=  AM_CXXFLAGS= "
[25 Nov 2010 22:16] Davi Arnaut
Heinz, you can workaround the problem by calling ./configure with --enable-mysql-maintainer-mode=no. The MySQL maintainer mode is enabled by default for debug builds, but is targeted at MySQL developers.
[7 Dec 2010 14:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/126219

3512 Davi Arnaut	2010-12-07
      Bug#57991: Compiler flag change build error : adler32.c
      
      Do not used the same maintainer mode flags for both GCC and
      ICC. The -Wall option for ICC enables more warnings than its
      GCC counterpart.
[7 Dec 2010 15:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/126222

3171 Davi Arnaut	2010-12-07
      Bug#57991: Compiler flag change build error : adler32.c
      
      Do not use the same maintainer mode flags for both GCC and
      ICC. The -Wall option for ICC enables more warnings than its
      GCC counterpart. For now, only enable -Wall for ICC, but do
      not turn warnings into errors.
[7 Dec 2010 15:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/126223

3512 Davi Arnaut	2010-12-07
      Bug#57991: Compiler flag change build error : adler32.c
      
      Do not use the same maintainer mode flags for both GCC and ICC.
      The -Wall option for ICC enables more warnings than its GCC
      counterpart.
[10 Dec 2010 16:37] Davi Arnaut
Queued to mysql-5.1-bugteam, null merged into mysql-5.5-bugteam.

Reported Bug#58871 to deal with a more general fix.
[17 Dec 2010 12:49] Bugs System
Pushed into mysql-5.1 5.1.55 (revid:georgi.kodinov@oracle.com-20101217124435-9imm43geck5u55qw) (version source revid:davi.arnaut@oracle.com-20101207150620-s49dstok48oy585o) (merge vers: 5.1.55) (pib:24)
[17 Dec 2010 12:53] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:georgi.kodinov@oracle.com-20101217124733-p1ivu6higouawv8l) (version source revid:davi.arnaut@oracle.com-20101210164739-xqxqgaqqxash7jhj) (merge vers: 5.5.8) (pib:24)
[17 Dec 2010 12:56] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:georgi.kodinov@oracle.com-20101217125013-y8pb3az32rtbplc9) (version source revid:sergey.glukhov@oracle.com-20101213110556-brvnmqklz5be7fx6) (merge vers: 5.6.1) (pib:24)
[22 Dec 2010 19:09] Paul DuBois
Noted in 5.1.55 changelog.

Configuration with maintainer mode enabled resulted in errors when
compiling with icc.