Bug #65743 cant debugging and porting mysql source code
Submitted: 27 Jun 2012 2:34 Modified: 16 Jan 2014 10:42
Reporter: Justin Xu Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.63, 5.1.65 OS:Linux
Assigned to: CPU Architecture:Any
Tags: porting debug

[27 Jun 2012 2:34] Justin Xu
Description:
hi all

Compile MySQL 5.1.63 source with --with-debug, errors like:

Making all in cmd-line-utils
make[1]: Entering directory `/dist/src/mysql-5.1.63/cmd-line-utils'
Making all in libedit
make[2]: Entering directory `/dist/src/mysql-5.1.63/cmd-line-utils/libedit'
if gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I../../include   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement -g  -DSAFE_MUTEX -g -O2   -DUNIV_LINUX -DUNIV_LINUX -MT el.o -MD -MP -MF ".deps/el.Tpo" -c -o el.o el.c; \
        then mv -f ".deps/el.Tpo" ".deps/el.Po"; else rm -f ".deps/el.Tpo"; exit 1; fi
cc1: warnings being treated as errors
el.c: In function ‘el_init’:
el.c:77: warning: implicit declaration of function ‘wcsdup’
el.c:77: warning: assignment makes pointer from integer without a cast
make[2]: *** [el.o] Error 1
make[2]: Leaving directory `/dist/src/mysql-5.1.63/cmd-line-utils/libedit'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/dist/src/mysql-5.1.63/cmd-line-utils'
make: *** [all-recursive] Error 1

Any ideas, thank you!

How to repeat:
MySQL source package mysql-5.1.63.tar.gz

the compiling process like:

cd mysql-5.1.63/
aclocal && autoheader
aclocal && cp -r BUILD/compile-pentium64-debug compile && automake
autoconf
./configure --prefix=/usr/local/mysql/ --with-mysqld-user=mysql --with-debug --with-plugins=example,innodb_plugin && make && make install
[27 Jun 2012 3:11] Justin Xu
The error is triggered by Makefile with '-Werror', then throw a compiling error 'cc1: warnings being treated as errors'.

AM_CFLAGS =  -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement
AM_CXXFLAGS =  -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wno-unused-parameter

How to slove?
[27 Jun 2012 3:18] Valeriy Kravchuk
Please, try to repeat build process without these steps:

aclocal && autoheader
aclocal && cp -r BUILD/compile-pentium64-debug compile && automake
autoconf

Just configure etc (or use BUILD/compile-pentium64-debug --prefix=... directly). 

See http://dev.mysql.com/doc/refman/5.1/en/installing-source-distribution.html for the description of "official" build process from source distribution.
[27 Jun 2012 3:29] Justin Xu
Thanks your reply.

I recompile, but it's the same thing. The new process like:

rm -rf mysql-5.1.63/
tar -zxf /mnt/hgfs/Dowload/mysql-5.1.63.tar.gz -C /dist/src/
cd mysql-5.1.63/
./configure --prefix=/usr/local/mysql/ --with-mysqld-user=mysql --with-debug=full --with-plugins=daemon_example,innodb_plugin && make && make install

If i remove the configure option '--with-debug=full', it's success to compile. Any ideas?
[27 Jun 2012 5:26] Valeriy Kravchuk
Please, send the output of:

gcc --version
[27 Jun 2012 9:06] Justin Xu
Thanks your reply.

# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[27 Jun 2012 10:07] Valeriy Kravchuk
Verified with current mysql-5.1 on 64-bit FC14. Error happens in other place, but reason is the same:

...
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement -g -DSAFE_MUTEX -DSAFEMALLOC -g -O2   -DUNIV_LINUX -DUNIV_LINUX -MT terminal.o -MD -MP -MF .deps/terminal.Tpo -c -o terminal.o terminal.c
cc1: warnings being treated as errors
terminal.c: In function ‘terminal_set’:
terminal.c:911:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:912:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:914:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:915:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:917:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:918:3: error: passing argument 1 of ‘tgetflag’ discards qualifiers from pointer target type
/usr/include/term.h:794:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:920:3: error: passing argument 1 of ‘tgetnum’ discards qualifiers from pointer target type
/usr/include/term.h:795:28: note: expected ‘char *’ but argument is of type ‘const char *’
terminal.c:921:3: error: passing argument 1 of ‘tgetnum’ discards qualifiers from pointer target type
/usr/include/term.h:795:28: note: expected ‘char *’ but argument is of type ‘const char *’
make[2]: *** [terminal.o] Error 1
make[2]: Leaving directory `/home/openxs/bzr/mysql-5.1-work/cmd-line-utils/libedit'
make[1]: *** [all-recursive] Error 1

This is what I did:

[openxs@chief mysql-5.1-work]$ fc -l
...
1015	 cd ../mysql-5.1-work/
1016	 bzr pull
1017	 ./configure --prefix=/usr/local/mysql/ --with-mysqld-user=mysql --with-debug=full --with-plugins=daemon_example,innodb_plugin
1018	 make
[3 Jul 2012 1:37] Justin Xu
Do u pull a development source tree from Launchpad?

I pulled it from LP by "bzr pull lp:~mysql/mysql-server/5.1 /dist/src/mysql-5.1-lp/", then follow "Installing MySQL from a Development Source Tree" document to compile. Below processes like:

autoreconf --force --install
aclocal && autoheader
libtoolize --automake --force
automake --force --add-missing && autoconf
./configure --prefix=/usr/local/mysql/ --with-mysqld-user=mysql --with-debug=full --with-plugins=daemon_example,innodb_plugin && make && make install

because of no a "configure" script in source branch, it must autoconf. But it's the same error:

make[2]: Entering directory `/dist/src/mysql-5.1-lp/cmd-line-utils/libedit'
if gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I../../include   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement -g -DSAFE_MUTEX -DSAFEMALLOC -g -O2   -DUNIV_LINUX -DUNIV_LINUX -MT el.o -MD -MP -MF ".deps/el.Tpo" -c -o el.o el.c; \
        then mv -f ".deps/el.Tpo" ".deps/el.Po"; else rm -f ".deps/el.Tpo"; exit 1; fi
cc1: warnings being treated as errors
el.c: In function ‘el_init’:
el.c:77: warning: implicit declaration of function ‘wcsdup’
el.c:77: warning: assignment makes pointer from integer without a cast
make[2]: *** [el.o] Error 1
make[2]: Leaving directory `/dist/src/mysql-5.1-lp/cmd-line-utils/libedit'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/dist/src/mysql-5.1-lp/cmd-line-utils'
make: *** [all-recursive] Error 1

I don't have any idea...
[3 Jul 2012 2:47] Justin Xu
Hi Valeriy

I successed to compile using mysql-5.1.63.tar.gz. Solution:

Edit file "cmd-line-utils/libedit/Makefile" by vim, remove "-Werror" of "AM_CFLAGS" and "AM_CXXFLAGS" before make && make install

Like this:
AM_CFLAGS =  -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wdeclaration-after-statement
AM_CXXFLAGS =  -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-unused-parameter

Thanks
[16 Jan 2014 10:42] Ståle Deraas
Posted by developer:
 
This bug is autotools specific, and thereby 5.1 only.If this is a problem in CMake and 5.5, please report another bug.