![Mod_Auth_MySQL 在 Slackware 13 下无法编译](https://linux22.com/image/16022/Mod_Auth_MySQL%20%E5%9C%A8%20Slackware%2013%20%E4%B8%8B%E6%97%A0%E6%B3%95%E7%BC%96%E8%AF%91.png)
我尝试将 auth_mod_auth (3.0.0) 模块添加到我的 Slackware 13 (apache 2.2 & MySQL 5.0) 系统中。
我运行了 apxs 的常用命令行(如 BUILD 文件中所述)
apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
但我收到以下错误:
/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
似乎 mysql 库与代码期望的不匹配。我环顾四周,它似乎是该模块的最后一个可用版本,尽管它已经过时了(2005 年 6 月)。
有没有人用类似的设置让它工作?我已经调整了半天没有成功:-(
答案1
我在这里找到了答案:http://bugs.gentoo.org/show_bug.cgi?format=multiple&id=192391
它有效! :-)
它在文件中更改APR_XtOffsetOf
为。APR_OFFSETOF
.c
解决问题的补丁:
--- 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 @@
static
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,
mysqlGroupUserNameField),
+ (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 }