configure: error: mysql configure failed. Please check config.log for more information.

chris (2007-09-16 10:06:05)
7389 views
1 replies
Compiling PHP isn't always as simple as ./configure; make; make install. The build process can be anything from 'dead easy' to 'barely possible', depending on your version of PHP, your operating system and what options you are compiling in.

When attempting to run ./configure with a standard bunch of options today, I kept getting the error above. I decided to exactly mimic the configure options I had used on a previous successful build of PHP on a different server and the php configure script still died. This is the configure command I was trying to use:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-zlib-dir=../zlib-1.2.3/' \
'--with-pdo-mysql=/usr/local/mysql' \
'--with-mysql=/usr/local/mysql'

This was on php 5.2.3, whereas today's build was on php 5.2.4. I have pasted that straight off the phpinfo screen - it doesn't work any more!

I did get configure to work however by opening up the mysql path which the --with-pdo-mysql= bit is pointing to. This configure then worked:
./configure 
--with-apxs2=/usr/local/apache2/bin/apxs 
--with-mysql 
--enable-pdo 
--with-zlib-dir=../zlib-1.2.3 
--with-pdo-mysql=/usr/local

The only problem them was that the compile stage failed. The error reported by make looked like this:
/usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:33:26: mysqld_error.h: No such file or directory
In file included from /usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:40:
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h: In function `pdo_mysql_get_sqlstate':
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: `WARN_DATA_TRUNCATED' undeclared (first use in this function)
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: (Each undeclared identifier is reported only once
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: for each function it appears in.)
make: *** [ext/pdo_mysql/mysql_driver.lo] Error 1

Well look at that. It appears that the mysqld_error.h file which is required to compile the mysql_driver.c couldn't be found. I'll run locate to see where that file is located:
% updatedb && locate mysqld_error.h
/usr/src/php-4.4.1/ext/mysql/libmysql/mysqld_error.h
/usr/local/mysql/include/mysqld_error.h
%

So the file is definitely there under the mysql path, but the build process isn't finding it and it's not packaged in the /ext/pdo_mysql directory. This would appear to be a bug to me. The only way to fix this and get php with pdo-mysql to compile would be to copy that file over:
% cp /usr/src/mysql-5.0.37/include/mysqld_error.h /usr/src/php-5.2.4/ext/pdo_mysql/.

With that header file now in place, php compiles just fine.

christo
comment
anonymous
2009-07-13 20:07:51

Compiling PHP isn't always as simple as ./configure; make; make install. The build process can be anything from 'dead easy' to 'barely possible', depending on your version of PHP, your operating system and what options you are compiling in.

When attempting to run ./configure with a standard bunch of options today, I kept getting the error above. I decided to exactly mimic the configure options I had used on a previous successful build of PHP on a different server and the php configure script still died. This is the configure command I was trying to use:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-zlib-dir=../zlib-1.2.3/' \
'--with-pdo-mysql=/usr/local/mysql' \
'--with-mysql=/usr/local/mysql'

This was on php 5.2.3, whereas today's build was on php 5.2.4. I have pasted that straight off the phpinfo screen - it doesn't work any more!

I did get configure to work however by opening up the mysql path which the --with-pdo-mysql= bit is pointing to. This configure then worked:
./configure 
--with-apxs2=/usr/local/apache2/bin/apxs 
--with-mysql 
--enable-pdo 
--with-zlib-dir=../zlib-1.2.3 
--with-pdo-mysql=/usr/local

The only problem them was that the compile stage failed. The error reported by make looked like this:
/usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:33:26: mysqld_error.h: No such file or directory
In file included from /usr/src/php-5.2.4/ext/pdo_mysql/mysql_driver.c:40:
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h: In function `pdo_mysql_get_sqlstate':
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: `WARN_DATA_TRUNCATED' undeclared (first use in this function)
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: (Each undeclared identifier is reported only once
/usr/src/php-5.2.4/ext/pdo_mysql/php_pdo_mysql_sqlstate.h:378: for each function it appears in.)
make: *** [ext/pdo_mysql/mysql_driver.lo] Error 1

Well look at that. It appears that the mysqld_error.h file which is required to compile the mysql_driver.c couldn't be found. I'll run locate to see where that file is located:
% updatedb && locate mysqld_error.h
/usr/src/php-4.4.1/ext/mysql/libmysql/mysqld_error.h
/usr/local/mysql/include/mysqld_error.h
%

So the file is definitely there under the mysql path, but the build process isn't finding it and it's not packaged in the /ext/pdo_mysql directory. This would appear to be a bug to me. The only way to fix this and get php with pdo-mysql to compile would be to copy that file over:
% cp /usr/src/mysql-5.0.37/include/mysqld_error.h /usr/src/php-5.2.4/ext/pdo_mysql/.

With that header file now in place, php compiles just fine.

christo



I have downloaded fro myslq.com new version

MySQL-client-community-5.1.36-0.rhel5.x86_64.rpm
MySQL-devel-community-5.1.36-0.rhel5.x86_64.rpm
MySQL-server-community-5.1.36-0.rhel5.x86_64.rpm
MySQL-shared-community-5.1.36-0.rhel5.x86_64.rpm

1. removed old one
2. installed new
3. make sym link: ln -s /usr/lib64/mysql /usr/lib/mysql
4. recompile it again rpmbuild -rebuild <filename.src.rpm>

all works now:)

best rtegards

reply iconedit reply