Bug #58987 PHP 5.3.4 won't compile with MySQL 5.5.8 GA
Submitted: 16 Dec 2010 21:56 Modified: 17 Dec 2010 17:13
Reporter: Ronald Bradford Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.5.8 OS:Linux (CentOS 5.5 i386)
Assigned to: CPU Architecture:Any
Tags: compiling, MySQL, packaging, php

[16 Dec 2010 21:56] Ronald Bradford
Description:
PHP 5.3.4 will compile with MySQL 5.1.54 but will not compile with MySQL 5.5.8

I can't determine if this is a MySQL packaging problem, or a PHP problem, however my workaround of MySQL includes addresses compiling problems. Error is

make
/bin/sh /opt/src/php-5.3.4/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/mysqli/ -I/opt/src/php-5.3.4/ext/mysqli/ -DPHP_ATOM_INC -I/opt/src/php-5.3.4/include -I/opt/src/php-5.3.4/main -I/opt/src/php-5.3.4 -I/opt/src/php-5.3.4/ext/date/lib -I/opt/src/php-5.3.4/ext/ereg/regex -I/usr/include/libxml2 -I/opt/src/php-5.3.4/ext/mbstring/oniguruma -I/opt/src/php-5.3.4/ext/mbstring/libmbfl -I/opt/src/php-5.3.4/ext/mbstring/libmbfl/mbfl -I/opt/mysql55/include -I/opt/src/php-5.3.4/ext/sqlite3/libsqlite -I/opt/src/php-5.3.4/TSRM -I/opt/src/php-5.3.4/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -prefer-non-pic -c /opt/src/php-5.3.4/ext/mysqli/mysqli.c -o ext/mysqli/mysqli.lo 
In file included from /opt/mysql55/include/my_sys.h:47,
                 from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:77,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/my_pthread.h:829:36: error: mysql/psi/mysql_thread.h: No such file or directory
In file included from /opt/mysql55/include/my_sys.h:47,
                 from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:77,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/my_pthread.h:836: error: expected specifier-qualifier-list before ‘mysql_cond_t’
In file included from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:77,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/my_sys.h:338: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/opt/mysql55/include/my_sys.h:354: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/opt/mysql55/include/my_sys.h:417: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
In file included from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:77,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/my_sys.h:964:27: error: mysql/psi/psi.h: No such file or directory
In file included from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:81,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/m_string.h:206:26: error: mysql/plugin.h: No such file or directory
In file included from /opt/src/php-5.3.4/ext/mysqli/php_mysqli_structs.h:81,
                 from /opt/src/php-5.3.4/ext/mysqli/mysqli.c:33:
/opt/mysql55/include/m_string.h: In function ‘lex_string_set’:
/opt/mysql55/include/m_string.h:291: error: dereferencing pointer to incomplete type
/opt/mysql55/include/m_string.h:292: error: dereferencing pointer to incomplete type
make: *** [ext/mysqli/mysqli.lo] Error 1

How to repeat:
Install virgin CentOS 5.5 32bit on Virtual box
yum upgade
yum install gcc libxml2_devel

mkdir -p /opt
cd /opt
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.8-linux2.6-i686.tar.gz/from/http://...
tar xvfz mysql-5.5.8-linux2.6-i686.tar.gz
ln -s mysql-5.5.8-linux2.6-i686 mysql55

mkdir -p /opt/src
cd /opt/src
wget http://us.php.net/get/php-5.3.4.tar.gz/from/us2.php.net/mirror
tar xvfz php-5.3.4.tar.gz 
cd php-5.3.4
./configure --prefix=/opt/php-5.3.4 --with-apxs2=/opt/httpd/bin/apxs --with-mysqli=/opt/mysql55/bin/mysql_config --enable-mbstring --with-zlib

Suggested fix:
Is this a workaround I don't really know, but remove mysql from the following include paths improves PHP compiling

/opt/mysql55/include/my_pthread.h:829:36: error: mysql/psi/mysql_thread.h: No such file or directory
/opt/mysql55/include/psi/mysql_thread.h:57:27: error: mysql/psi/psi.h: No such file or directory
/opt/mysql55/include/my_sys.h:964:27: error: mysql/psi/psi.h: No such file or directory
/opt/mysql55/include/m_string.h:206:26: error: mysql/plugin.h: No such file or directory
/opt/mysql55/include/plugin.h:51:28: error: mysql/services.h: No such file or directory
/opt/mysql55/include/services.h:21:39: error: mysql/service_my_snprintf.h: No such file or directory
/opt/mysql55/include/services.h:22:37: error: mysql/service_thd_alloc.h: No such file or directory
/opt/mysql55/include/services.h:23:36: error: mysql/service_thd_wait.h: No such file or directory
/opt/mysql55/include/services.h:24:44: error: mysql/service_thread_scheduler.h: No such file or directory
[16 Dec 2010 21:57] Ronald Bradford
PHP 5.3.4 is the current stable version of PHP
[17 Dec 2010 2:50] Paul DuBois
Looks like Bug#51925 is still an issue. I downloaded a Mac OS X 5.5.8 binary distribution and all the header files are still installed in a single directory. That is, the heirarchy of the header files in the source tree is not respected: All headers are "flattened" into a single install directory.
[17 Dec 2010 11:23] Sveta Smirnova
Thank you for the report.

Please confirm if this is duplicate of bug #51925: try workaround there (option -I/opt/mysql55/include).
[17 Dec 2010 15:26] Ronald Bradford
Problem still exists.

cd /opt/src/php-5.3.4
make clean
make

# confirm error in place

make clean
./configure --prefix=/opt/php-5.3.4 --with-apxs2=/opt/httpd/bin/apxs --with-mysqli=/opt/mysql55/bin/mysql_config --enable-mbstring --with-zlib
make -I/opt/mysql55/include

# Error still exists
[17 Dec 2010 16:50] Ronald Bradford
A workaround that requires no code changes is:

--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
[17 Dec 2010 17:02] Sveta Smirnova
Thank you for the feedback.

Got error:

----<q>----
/opt/mysql55/include/services.h:21:39: error: mysql/service_my_snprintf.h: No such file
or directory
/opt/mysql55/include/services.h:22:37: error: mysql/service_thd_alloc.h: No such file or
directory
/opt/mysql55/include/services.h:23:36: error: mysql/service_thd_wait.h: No such file or
directory
/opt/mysql55/include/services.h:24:44: error: mysql/service_thread_scheduler.h: No such
file or directory
----</q>-----

Even having proper options will not help. But this still duplicate of bug #51925
[17 Dec 2010 17:13] Ronald Bradford
Happy for you to report as duplicate, seems likely from what I've seen.