2011-05-24 102 views
0

如何建立雪豹mod_auth_mysql?编译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 

回答

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到apxs命令行:

编辑:

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

干杯您的设置!

1

我不得不稍微调整这一点,所以它会在Mac mini上的Core Duo(不能够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: No such file or directory apxs:Error: Command failed with rc=65536

,那么你要么必须安装的XCode所有,或符号连接到默认的工具链:

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

另外:尼尔斯Preusker的博客已关闭。您可能会在Google的缓存中找到答案。另外,我已经在这里贴的相关部分:

编译和尼尔斯 在OS X 10.5.6

2009年4月17日安装mod_auth_mysql的apche的模块mod_auth_mysql能够使用MySQL数据库,而不是如一个passwd文件。有一个用于Mac OS X 10.4的模块安装程序,但没有用于Mac OS X 10.5或更高版本的安装包或端口。我玩弄了一些源代码,最后设法让它编译,并且apache在没有错误信息的情况下启动。我创建了一个diff文件来修补mod_auth_mysql.c。以下步骤介绍了如何应用该补丁,编译该模块并测试您的apache配置。

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

$ 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 应用补丁,我们切换到源目录并执行UNIX补丁程序,它的原始文件和差异文件应用补丁:

$ 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),