Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to add the auth_mod_auth (3.0.0) module to my Slackware 13 (apache 2.2 & MySQL 5.0) system.

I ran the usual command line for apxs (as mention in the BUILD file)

apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c

but I got the following error:

/usr/lib/apr-1.3.12/build-1/libtool --silent --mode=compile i486-slackware-linux-gcc -prefer-pic -O2 -march=i486 -mtune=i686  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/include/mysql  -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
mod_auth_mysql.c:591: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:591: error: initializer element is not constant
mod_auth_mysql.c:591: error: (near initialization for 'mysql_auth_cmds[0].cmd_data')
mod_auth_mysql.c:595: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:595: error: initializer element is not constant
mod_auth_mysql.c:595: error: (near initialization for 'mysql_auth_cmds[1].cmd_data')
mod_auth_mysql.c:599: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:599: error: initializer element is not constant
mod_auth_mysql.c:599: error: (near initialization for 'mysql_auth_cmds[2].cmd_data')
mod_auth_mysql.c:603: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:603: error: initializer element is not constant
mod_auth_mysql.c:603: error: (near initialization for 'mysql_auth_cmds[3].cmd_data')
mod_auth_mysql.c:607: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:607: error: initializer element is not constant
mod_auth_mysql.c:607: error: (near initialization for 'mysql_auth_cmds[4].cmd_data')
mod_auth_mysql.c:611: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:611: error: initializer element is not constant
mod_auth_mysql.c:611: error: (near initialization for 'mysql_auth_cmds[5].cmd_data')
mod_auth_mysql.c:615: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:615: error: initializer element is not constant
mod_auth_mysql.c:615: error: (near initialization for 'mysql_auth_cmds[6].cmd_data')
mod_auth_mysql.c:619: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:619: error: initializer element is not constant
mod_auth_mysql.c:619: error: (near initialization for 'mysql_auth_cmds[7].cmd_data')
mod_auth_mysql.c:623: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:623: error: initializer element is not constant
mod_auth_mysql.c:623: error: (near initialization for 'mysql_auth_cmds[8].cmd_data')
mod_auth_mysql.c:627: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:627: error: initializer element is not constant
mod_auth_mysql.c:627: error: (near initialization for 'mysql_auth_cmds[9].cmd_data')
mod_auth_mysql.c:631: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:631: error: initializer element is not constant
mod_auth_mysql.c:631: error: (near initialization for 'mysql_auth_cmds[10].cmd_data')
mod_auth_mysql.c:635: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:635: error: initializer element is not constant
mod_auth_mysql.c:635: error: (near initialization for 'mysql_auth_cmds[11].cmd_data')
mod_auth_mysql.c:639: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:639: error: initializer element is not constant
mod_auth_mysql.c:639: error: (near initialization for 'mysql_auth_cmds[12].cmd_data')
mod_auth_mysql.c:643: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:643: error: initializer element is not constant
mod_auth_mysql.c:643: error: (near initialization for 'mysql_auth_cmds[13].cmd_data')
mod_auth_mysql.c:651: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:651: error: initializer element is not constant
mod_auth_mysql.c:651: error: (near initialization for 'mysql_auth_cmds[14].cmd_data')
mod_auth_mysql.c:655: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:655: error: initializer element is not constant
mod_auth_mysql.c:655: error: (near initialization for 'mysql_auth_cmds[15].cmd_data')
mod_auth_mysql.c:659: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:659: error: initializer element is not constant
mod_auth_mysql.c:659: error: (near initialization for 'mysql_auth_cmds[16].cmd_data')
mod_auth_mysql.c:663: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:663: error: initializer element is not constant
mod_auth_mysql.c:663: error: (near initialization for 'mysql_auth_cmds[17].cmd_data')
mod_auth_mysql.c:667: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:667: error: initializer element is not constant
mod_auth_mysql.c:667: error: (near initialization for 'mysql_auth_cmds[18].cmd_data')
mod_auth_mysql.c:671: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:671: error: initializer element is not constant
mod_auth_mysql.c:671: error: (near initialization for 'mysql_auth_cmds[19].cmd_data')
mod_auth_mysql.c: In function 'format_request':
mod_auth_mysql.c:947: warning: pointer/integer type mismatch in conditional expression
apxs:Error: Command failed with rc=65536

Seems like the mysql library do not match what the code expect. I looked around and it seems to be the last available version of the module although is getting old (june 2005).

Has anyone made it work with a similar setup? I've been tweaking around for half a day without any success :-(

share|improve this question
At a quick glance this kind of error could be triggered by a missing dependency (did you check that you had all the required stuff installed?), an out-of-date dependency (hopefully not the case if that's indeed the latest available module) or a misconfiguration (I've never compiled an Apache module, is there anything like ./configure?). Is that your whole compilation log, or did you cut earlier output? The whole transcript of your session from when you unpacked might help. – Gilles Feb 20 '11 at 23:07
Gilles, compiling a apache module is not the traditional "configure, make & make install". All go thru apxs command line who call gcc and the libtool. The whole output of the command is show up there! I have done this before but it was with apache 1.x and MySQL 3.x (long time ago!). I pretty sure that it have something to do with MySQL 5.0 because the doc from source forge speak about 4.1 and in 2005, MySQL 5.0 was not really around. – Steve S. Feb 20 '11 at 23:49
Someone report the exact same problem mail-archives.apache.org/mod_mbox/httpd-users/200512.mbox/… but no answer there! – Steve S. Feb 21 '11 at 0:23

I found an answer here: http://bugs.gentoo.org/show_bug.cgi?format=multiple&id=192391

And it works! :-)

It changes APR_XtOffsetOf to APR_OFFSETOF in the .c file.

Patch which solves the problem:

--- mod_auth_mysql.c.orig       2007-09-13 09:36:14.000000000 +0200
+++ mod_auth_mysql.c    2007-09-13 09:41:49.000000000 +0200
@@ -589,87 +589,87 @@
 command_rec mysql_auth_cmds[] = {
        AP_INIT_TAKE1("AuthMySQLHost", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlhost),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlhost),
        OR_AUTHCFG, "mysql server host name"),

        AP_INIT_TAKE1("AuthMySQLPort", ap_set_int_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlport),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlport),
        OR_AUTHCFG, "mysql server port number"),

        AP_INIT_TAKE1("AuthMySQLSocket", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlsocket),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlsocket),
        OR_AUTHCFG, "mysql server socket path"),

        AP_INIT_TAKE1("AuthMySQLUser", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqluser),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqluser),
        OR_AUTHCFG, "mysql server user name"),

        AP_INIT_TAKE1("AuthMySQLPassword", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpasswd),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpasswd),
        OR_AUTHCFG, "mysql server user password"),

        AP_INIT_TAKE1("AuthMySQLDB", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlDB),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlDB),
        OR_AUTHCFG, "mysql database name"),

        AP_INIT_TAKE1("AuthMySQLUserTable", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpwtable),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpwtable),
        OR_AUTHCFG, "mysql user table name"),

        AP_INIT_TAKE1("AuthMySQLGroupTable", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlgrptable),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlgrptable),
        OR_AUTHCFG, "mysql group table name"),

        AP_INIT_TAKE1("AuthMySQLNameField", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNameField),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNameField),
        OR_AUTHCFG, "mysql User ID field name within User table"),

        AP_INIT_TAKE1("AuthMySQLGroupField", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupField),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupField),
        OR_AUTHCFG, "mysql Group field name within table"),

        AP_INIT_TAKE1("AuthMySQLGroupUserNameField", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec,
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupUserNameField),
        OR_AUTHCFG, "mysql User ID field name within Group table"),

        AP_INIT_TAKE1("AuthMySQLPasswordField", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlPasswordField),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlPasswordField),
        OR_AUTHCFG, "mysql Password field name within table"),

        AP_INIT_TAKE1("AuthMySQLPwEncryption", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEncryptionField),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEncryptionField),
        OR_AUTHCFG, "mysql password encryption method"),

        AP_INIT_TAKE1("AuthMySQLSaltField", ap_set_string_slot,
-       (void*) APR_XtOffsetOf(mysql_auth_config_rec, mysqlSaltField),
+       (void*) APR_OFFSETOF(mysql_auth_config_rec, mysqlSaltField),
        OR_AUTHCFG, "mysql salfe field name within table"),

 /*     AP_INIT_FLAG("AuthMySQLKeepAlive", ap_set_flag_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlKeepAlive),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlKeepAlive),
        OR_AUTHCFG, "mysql connection kept open across requests if On"),
        AP_INIT_FLAG("AuthMySQLAuthoritative", ap_set_flag_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlAuthoritative),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlAuthoritative),
        OR_AUTHCFG, "mysql lookup is authoritative if On"),

        AP_INIT_FLAG("AuthMySQLNoPasswd", ap_set_flag_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNoPasswd),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNoPasswd),
        OR_AUTHCFG, "If On, only check if user exists; ignore password"),

        AP_INIT_FLAG("AuthMySQLEnable", ap_set_flag_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEnable),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEnable),
        OR_AUTHCFG, "enable mysql authorization"),

        AP_INIT_TAKE1("AuthMySQLUserCondition", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlUserCondition),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlUserCondition),
        OR_AUTHCFG, "condition to add to user where-clause"),

        AP_INIT_TAKE1("AuthMySQLGroupCondition", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupCondition),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupCondition),
        OR_AUTHCFG, "condition to add to group where-clause"),

        AP_INIT_TAKE1("AuthMySQLCharacterSet", ap_set_string_slot,
-       (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlCharacterSet),
+       (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlCharacterSet),
        OR_AUTHCFG, "mysql character set to be used"),

   { NULL }
share|improve this answer
Addendum : Modify also this line #define STRCAT ap_pstrcat for #define STRCAT apr_pstrcat, otherwise your module will not load (looking for a missing ap_pstrcat symbol, the 1.3 API version instead of the 2.0 version) – Steve S. Feb 21 '11 at 3:07
Addendum 2 : If you compiled, installed and start your apache server and it still doesn't work then try this line in your *.conf ou .htaccess file : AuthBasicAuthoritative Off. Since Apache 2.2 all the auth stuff changed a lot!!! – Steve S. Feb 22 '11 at 4:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.