Bug #47026 MySQL can't make with gcc version 3.4.6-11 (new)
Submitted: 31 Aug 2009 17:47 Modified: 3 Sep 2009 21:42
Reporter: Gabriele Lanza Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:6.0.11-alpha OS:Linux (Centos 4.8)
Assigned to: CPU Architecture:Any
Tags: mysql 6 php 6 gcc 3.4.6-11 error make

[31 Aug 2009 17:47] Gabriele Lanza
Description:
It is a PHP related error. Trying to make against MySQL6.0.11-alpha returns this pile of errors and does not make while previously had. In the meantime only gcc has been upgraded to 3.4.6-11 so that may be the problem. I am reporting this problem in both 3 involved products bug system so it may get fixed.

How to repeat:
Try to make php6.0-dev against mysql6.0.11-alpha with gcc 3.4.6-11 and following config line

./configure --with-openssl --enable-ctype --with-curl --enable-exif --with-iconv --enable-json --enable-libxml --enable-mbstring --with-bz2 --enable-soap --enable-bcmath --enable-calendar --enable-ftp --with-gd=/usr/local/bin/gdlib-config --with-mcrypt --with-mhash --enable-zip --enable-xmlreader --enable-xmlwriter --with-mysql --with-mysqli=/usr/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --with-pear --with-zlib --enable-gd-native-ttf --with-pgsql=/usr/bin --enable-maintainer-zts  --with-imap --with-kerberos --with-imap-ssl --with-xsl --enable-zend-multibyte --enable-wddx --enable-shmop --with-ldap --with-oci8=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server --with-db4
[31 Aug 2009 17:49] Valeriy Kravchuk
Thank you for the problem report. What exact MySQL-related errors do you get?
[31 Aug 2009 17:50] Gabriele Lanza
Errors

Attachment: file.txt (text/plain), 12.30 KiB.

[31 Aug 2009 17:55] Gabriele Lanza
the errors are listed in the file above. basically gcc complains that the include file mysql.h is full of errors, while with lover gcc it compiled succesfully.

i reported it here since it is saying that mysql.h is full of errors, so the problem might be also mysql related, since php only "includes" a copy of that file.
[31 Aug 2009 20:47] Sveta Smirnova
Thank you for the feedback.

I assume PHP bug which you opened is http://bugs.php.net/bug.php?id=49421? In this bug you said you successfully compiled PHP5. So can we say problem is only repeatable if compile PHP6 with MySQL 6.0.11?
[31 Aug 2009 22:12] Gabriele Lanza
Yes it is. We CAN assume that the problem happens only with PHP6 (php5.3 compiles and makes succesfully) but what I don't know is the linking type.

I mean:

I don't know if php5.3-dev and php6.0-dev link against mysql in the same way. (i.e. I don't know if php5.3-dev and php6.0-dev include the same file(s) and in the same way (same functions or so). That said, I can't tell weather the bug is php, mysql or compiler related.

On thing is certain: gcc HAS been upgraded in the meantime. That lead me to try to recompile php 5.3-dev (fresh sources) to see if the bug was still present and at the end it wasn't. php5.3-dev compiles succesfully.

In the past, php6.0-dev compiled succesfully too so I'm not able to understand what is wrong where, I only suppose that the problem might origin from a combination of factors, such as compiler upgraded, mysql version and php version.
I also tried to remove from php the --with-mysql line and leave the --with-mysqli=/usr/bin/mysql_config and in this case php compiles succesfully, so the problem resides inside mysql.h include or misunderstanding between compiler, php and mysql headers.
[31 Aug 2009 23:20] Gabriele Lanza
UPDATE:

More informations:
Recently I upgraded my box from CentOS 4.7 to CentOS 4.8 (20 august). Issues with php mysql and the compiler begun after this upgrade.

More News:

I tried to install on my box gcc4-* from CentOS repository. The error list shortened to this:

/bin/sh /root/php6.0-200908312230/libtool --silent --preserve-dup-deps --mode=compile /root/php6.0-200908312230/meta_ccld  -Imain/ -I/root/php6.0-200908312230/main/ -DPHP_ATOM_INC -I/root/php6.0-200908312230/include -I/root/php6.0-200908312230/main -I/root/php6.0-200908312230 -I/usr/local/include -I/root/php6.0-200908312230/ext/date/lib -I/root/php6.0-200908312230/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/imap -I/root/php6.0-200908312230/ext/mbstring/oniguruma -I/root/php6.0-200908312230/ext/mbstring/libmbfl -I/root/php6.0-200908312230/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public -I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo -I/root/php6.0-200908312230/ext/sqlite3/libsqlite -I/root/php6.0-200908312230/TSRM -I/root/php6.0-200908312230/Zend  -D_REENTRANT -DTHREAD=1  -I/usr/include -g -O2 -pthread -DZTS  -prefer-non-pic -c main/internal_functions.c -o main/internal_functions.lo 
In file included from /usr/include/mysql/mysql.h:74,
                 from /root/php6.0-200908312230/ext/mysql/php_mysql_structs.h:43,
                 from main/internal_functions.c:58:
/usr/include/mysql/my_list.h:26: error: expected identifier or '(' before numeric constant
/usr/include/mysql/my_list.h:30: error: expected identifier or '(' before numeric constant
/usr/include/mysql/my_list.h:31: error: expected identifier or '(' before numeric constant
/usr/include/mysql/my_list.h:32: error: expected identifier or '(' before numeric constant
/usr/include/mysql/my_list.h:33: error: expected identifier or '(' before numeric constant
/usr/include/mysql/my_list.h:34: error: expected declaration specifiers or '...' before numeric constant
/usr/include/mysql/my_list.h:35: error: expected declaration specifiers or '...' before numeric constant
/usr/include/mysql/my_list.h:36: error: expected declaration specifiers or '...' before numeric constant
In file included from /root/php6.0-200908312230/ext/mysql/php_mysql_structs.h:43,
                 from main/internal_functions.c:58:
/usr/include/mysql/mysql.h:266: error: expected specifier-qualifier-list before numeric constant
/usr/include/mysql/mysql.h:574: error: expected specifier-qualifier-list before numeric constant
make: *** [main/internal_functions.lo] Error 1

So i think we can now assume that the main responsible for this behaviour is the compiler update of CentOS 4.8 and some PHP6/MYSQL6 interactions with it.
The worse is now to understand what is going on...
[1 Sep 2009 0:38] Gabriele Lanza
Still trying but no luck

I am now analysing php Makefile(s) to look for some differences but surprisingly there aren't.

Both have MYSQL_INCLUDE = -I/usr/include/mysql directive, so there should be no way in hell why with 5.3-dev compilation is successful and with 6.0-dev it fails poorly.

The compiler likes the mysql.h the first time but not the second...so at this point I have to suspect the compiler beeing called in a wrong way or with some missing flags by php but it's a really strange surreal situation...
[1 Sep 2009 5:41] Sveta Smirnova
Thank you for the feedback.

Do you have 2 installations of MySQL in different places? Can it happen what --with-mysql takes headers/libraries from one (default) installation while --with-mysqli from another, specified one?
[1 Sep 2009 12:54] Gabriele Lanza
I thought about that, but correcting --with-mysql with --with-mysql=/usr/bin/mysql_config does not help, since mysql_config points to /usr/include/mysql that is the same directory points to without correction

Usage: /usr/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/include/mysql  -g -pipe -DUNIV_LINUX]
        --include        [-I/usr/include/mysql]
        --libs           [-rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lrt -lcrypt -lnsl -lm -lmygcc]
        --libs_r         [-rdynamic -L/usr/lib/mysql -lmysqlclient_r -lz -lnsl -lrt -lresolv -lrt -lpthread -lrt -lcrypt -lnsl -lm -lpthread -lmygcc]
        --plugindir      [/usr/lib/mysql/plugin]
        --socket         [/var/lib/mysql/mysql.sock]
        --port           [0]
        --version        [6.0.11-alpha]
        --libmysqld-libs [-rdynamic -L/usr/lib/mysql -lmysqld -ldl -lz -lnsl -lrt -lresolv -lrt -lpthread -lrt -lcrypt -lnsl -lm -lpthread -lrt -lmygcc]
[2 Sep 2009 2:10] Gabriele Lanza
anyway, it seems more like syntax bug...that only unveals itself compiling with php6 and not php5.3.

That's the most strange and odd thing. I can't figure myself (beeing also an informatic boy) why with the same situation, with 5.3 it goes and with 6 it fails.

include is always the same, so it should point to the same library and even if the library would be bad, there wouldn't be any syntax errors, but only functions error (complainings about missing functions or so).

At this stage it is obvious that upgrading gcc lead to this problems, but it is not only gcc's fault but even php and maybe mysql fault, since if it was only gcc's, even php5.3 compilation would have been broken and this condition is not true.

So now we have:

php5.3-dev: compile succesfull against mysql6.0.11-alpha with gcc 3.4.6-11
php6.0-dev: compile error against mysql6.0.11-alpha with gcc 3.4.6-11

using gcc4, errors reduce themselves.

I'm really puzzled...I hope to have someone help to solve my problem since I'm becoming mad :(
[3 Sep 2009 21:42] Sveta Smirnova
Thank you for the feedback.

I can not repeat described behavior with development version mysql-next which inherits MySQL 6.0. so closing report as "Can't repeat". In any case gcc 3.4.6 is outdated and if bug is not repeatable with gcc 4 should be safe to close this report with such a status. I tested with gcc 3.4.6