在雪豹上编译mod_auth_mysql

时间:2011-05-24 08:59:39

标签: apache2

如何在Snow Leopard上构建mod_auth_mysql?

我决定在答案中记录这些内容,而不是将我的发现隐藏在某些博客评论中。

我遇到以下错误:

May 24 10:43:44 host org.apache.httpd[6764]: httpd: Syntax error on line 120 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_auth_mysql.so into server: dlopen(/usr/libexec/apache2/mod_auth_mysql.so, 10): Symbol not found: _make_scrambled_password\n  Referenced from: /usr/libexec/apache2/mod_auth_mysql.so\n  Expected in: flat namespace\n in /usr/libexec/apache2/mod_auth_mysql.so
May 24 11:14:06 host org.apache.httpd[10880]: httpd: Syntax error on line 120 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_auth_mysql.so into server: dlopen(/usr/libexec/apache2/mod_auth_mysql.so, 10): Library not loaded: libmysqlclient.18.dylib\n  Referenced from: /usr/libexec/apache2/mod_auth_mysql.so\n  Reason: image not found

2 个答案:

答案 0 :(得分:1)

我不得不稍微调整一下,因此它可以运行在Mac mini核心二重奏(不具备64位代码)上,本质上,你只需要省略对64位架构的引用:

$ sudo apxs -c -i -a -D lmysqlclient -lmysqlclient -lm -lz -I/usr/local/mysql/include/ \
-L/usr/local/mysql/lib/ mod_auth_mysql.c

如果您在找不到XCode工具链的cc时出错:

  

env:/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc:没有这样的文件或目录   apxs:错误:命令失败,rc = 65536

然后您必须完全安装XCode,或者将符号链接安装到默认工具链:

$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain

另外:Nils Preusker的Blog已关闭。您可能会在Google的缓存中找到答案。另外,我在这里粘贴了相关部分:

在OS X 10.5.6上编译和安装mod_auth_mysql

2009年4月17日,由nils apche模块mod_auth_mysql使得可以使用MySQL数据库而不是例如MySQL数据库。一个passwd文件。有适用于Mac OS X 10.4的模块安装程序,但没有适用于Mac OS X 10.5或更高版本的安装包或端口。我玩了一下源代码,最后设法让它编译和apache开始没有错误消息。我已经创建了一个diff文件来修补mod_auth_mysql.c。以下步骤说明如何应用修补程序,编译模块并测试Apache配置。

我们首先在您的用户目录中创建一个src文件夹,下载mod_auth_mysql并展开它:

$ mkdir ~/src
$ cd ~/src
$ curl -O http://puzzle.dl.sourceforge.net/sourceforge/\
modauthmysql/mod_auth_mysql-3.0.0.tar.gz
$ tar zxvf mod_auth_mysql-3.0.0.tar.gz

现在您拥有mod_auth_mysql-3.0.0文件夹中的模块源代码。在我们编译它之前,必须应用补丁。这是差异文件mod_auth_mysql,将其保存到

〜/ SRC / mod_auth_mysql-3.0.0 / mod_auth_mysql.diff 要应用补丁,我们将更改为sources目录并执行带有原始文件的unix补丁程序,并将diff文件应用为补丁:

$ cd mod_auth_mysql-3.0.0
$ patch mod_auth_mysql.c mod_auth_mysql.diff

继续使用32位或64位代码......

如果diff文件丢失,这里就是......

209c209
<   #define STRCAT ap_pstrcat
---
>   #define STRCAT apr_pstrcat
592c592
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlhost),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlhost),
596c596
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlport),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlport),
600c600
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlsocket),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlsocket),
604c604
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqluser),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqluser),
608c608
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpasswd),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpasswd),
612c612
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlDB),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlDB),
616c616
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpwtable),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpwtable),
620c620
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlgrptable),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlgrptable),
624c624
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNameField),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNameField),
628c628
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupField),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupField),
632c632
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupUserNameField),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupUserNameField),
636c636
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlPasswordField),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlPasswordField),
640c640
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEncryptionField),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEncryptionField),
644c644
<   (void*) APR_XtOffsetOf(mysql_auth_config_rec, mysqlSaltField),
---
>   (void*) APR_OFFSETOF(mysql_auth_config_rec, mysqlSaltField),
652c652
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlAuthoritative),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlAuthoritative),
656c656
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNoPasswd),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNoPasswd),
660c660
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEnable),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEnable),
664c664
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlUserCondition),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlUserCondition),
668c668
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupCondition),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupCondition),
672c672
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlCharacterSet),
---
>   (void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlCharacterSet),

答案 1 :(得分:0)

  • 首先按照Nils Preusker's blog上的说明操作,特别是应用他的补丁。
  • 检查mysqls .dylib文件中存储的路径信息
    • otool -DX /usr/local/mysql/lib/libmysqlclient.18.dylib
    • 这应该返回一个完整的路径,你不必先通过调用
    • 来修复它
    • sudo install_name_tool -id /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib
  • -lmysqlclient添加到a​​pxs命令行:

<强>汇编:

sudo apxs -c -i -a -D lmysqlclient -lmysqlclient -lm -lz \ 
 -I/usr/local/mysql/include/ \
 -L/usr/local/mysql/lib/ -Wc,"-arch x86_64" \
 -Wl,"-arch x86_64" mod_auth_mysql.c
  • 确保列出了mysql库:otool -L /usr/libexec/apache2/mod_auth_mysql.so
  • 使用apachectl configtest检查您的设置

干杯!

相关问题