Hi Nick, I think you are right about crash reason. It probably was an incompatibility of http and apr-util, which I built separately to overcame configuration issues. Once I've had the clean build, the problem disappeared. There are three issues with the current auto-configuration regarding activation mysql driver for DBD:
1. Autoconf doesn't find mysqlclient library in default place and doesn't
allow user to point to it besides LDFLAGS.
3. It always fails to test existence of mysqlclient_r, since the test
doesn't include -lpthread, which it required.
2. apr_dbd_mysql.c has stale HAVE_MYSQL_H directives, which autoconf
doesn't set. Instead autoconf logic relies on includes dirs.
I would suggest to make following patches. The first one will
automatically provide paths for includes and libs by utilizing
mysql_config, which is probably very portable. The second one will get
rid of stale directives from mysql driver.
Having them makes activating mysql driver as simple as:
./buildconf
./configure --with-mysql
./make install
Tested with mysql 5.0 on CentOS 4.3 and mysql 4.1 on FreeBSD 5.4.
--- dbd.m4.orig 2005-05-05 23:24:29.000000000 +0400
+++ dbd.m4 2006-07-23 23:32:03.000000000 +0400
@@ -75,50 +75,34 @@
AC_ARG_WITH([mysql], [
--with-mysql=DIR **** SEE INSTALL.MySQL ****
], [
- apu_have_mysql=0
- if test "$withval" = "yes"; then
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init,
[apu_have_mysql=1]))
- if test "$apu_have_mysql" == "0"; then
- AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init,
[apu_have_mysql=1]))
- if test "$apu_have_mysql" != "0"; then
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/myql])
- fi
- fi
- elif test "$withval" = "no"; then
- apu_have_mysql=0
- else
- CPPFLAGS="-I$withval/include"
- LIBS="-L$withval/lib "
- AC_MSG_NOTICE(checking for mysql in $withval)
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init,
[apu_have_mysql=1]))
- if test "$apu_have_mysql" != "0"; then
- APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
- fi
+ if test "$withval" != "no"; then
+
+ AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no,
[$PATH:$withval/bin:$withval])
+ if test "$MYSQL_CONFIG" = "no"; then
+ AC_MSG_ERROR([Unable to find mysql_config])
+ else
+ dnl mysql_config found
+ AC_MSG_CHECKING([mysql ])
+ mysql_version=`$MYSQL_CONFIG --version`
+ MYSQL_LIBS=`$MYSQL_CONFIG --libs_r`
+ MYSQL_INCLUDE=`$MYSQL_CONFIG --include`
+ AC_MSG_RESULT([ version $mysql_version ])
+
+ AC_CHECK_LIB(mysqlclient_r, mysql_init, [ apu_have_mysql=1 ],
AC_MSG_ERROR([Unable to find mysqlclient_r]), $MYSQL_LIBS)
+
+ APR_ADDTO(APRUTIL_INCLUDES, [$MYSQL_INCLUDE])
+ APR_ADDTO(APRUTIL_EXPORT_LIBS, [$MYSQL_LIBS])
- if test "$apu_have_mysql" != "1"; then
- AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init,
[apu_have_mysql=1]))
- if test "$apu_have_mysql" != "0"; then
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
- APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
- fi
- fi
+ fi
fi
- ], [
- apu_have_mysql=0
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init,
[apu_have_mysql=1]))
+
])
AC_SUBST(apu_have_mysql)
-
- dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
- dnl we know the library is there.
- if test "$apu_have_mysql" = "1"; then
- APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lmysqlclient_r])
- APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r])
- fi
])
+
+
dnl
AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
apu_have_sqlite3=0
# diff -u apr_dbd_mysql.c apr_dbd_mysql.c.orig
--- apr_dbd_mysql.c Sun Jul 23 21:03:25 2006
+++ apr_dbd_mysql.c.orig Sun Jul 23 16:01:17 2006
@@ -45,13 +45,8 @@
#include <ctype.h>
#include <stdlib.h>
-#ifdef HAVE_MYSQL_H
#include <mysql.h>
#include <errmsg.h>
-#elif defined(HAVE_MYSQL_MYSQL_H)
-#include <mysql/mysql.h>
-#include <mysql/errmsg.h>
-#endif
#include "apr_strings.h"
Hope, that will help other non-programmers like me to avoid linking
clashes trying to build all manually.
Besides that, I still can't get DBD authorization with mysql driver running.
It is very hard to guess, what it behind the error:
"Internal error: DBD: failed to initialise prepared SQL statements"
when the query as simple as
"select PASS from Users where LOGIN=?"
I have been trying to implement mysql errno printing to get at least
the direction of the problem, but I haven't found the proper way, how
to do that. A text of the error must upraise through 3 layers of
driver, driver wrapper and mod_dbd, but now the is no enough
"infrastructure" around.
I would be very-very grateful for the help with debugging this.
Anton Golubev
ENGECON
St. Petersburg
smime.p7s
Description: S/MIME Cryptographic Signature
