在雪豹上编译mod_auth_mysql

问题描述

| 如何在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
    

解决方法

我必须稍作调整,以使其可以在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工具链的抄送:   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的博客已关闭。您可能仍会在Google的缓存中找到答案。另外,我在这里粘贴了相关部分: 在OS X 10.5.6上编译和安装mod_auth_mysql 2009年4月17日,作者nils apche模块mod_auth_mysql使得可以使用MySQL数据库而不是例如一个passwd文件。 Mac OS X 10.4有该模块的安装程序,但Mac OS X 10.5或更高版本没有安装包或端口。我对源代码进行了一些尝试,最后设法使其编译并使其开始运行,而没有出现错误消息。我创建了一个差异文件来修补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目录,并执行采用原始文件并将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,596c596
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlport),600c600
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlsocket),604c604
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqluser),608c608
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlpasswd),612c612
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlDB),616c616
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlpwtable),620c620
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlgrptable),624c624
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlNameField),628c628
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlGroupField),632c632
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlGroupUserNameField),636c636
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlPasswordField),640c640
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlEncryptionField),644c644
<   (void*) APR_XtOffsetOf(mysql_auth_config_rec,mysqlSaltField),---
>   (void*) APR_OFFSETOF(mysql_auth_config_rec,652c652
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlAuthoritative),656c656
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlNoPasswd),660c660
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlEnable),664c664
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlUserCondition),668c668
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlGroupCondition),672c672
<   (void *) APR_XtOffsetOf(mysql_auth_config_rec,mysqlCharacterSet),
    ,首先,按照Nils Preusker博客上的说明进行操作,尤其是应用他的补丁。 检查什么路径信息存储在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
在apxs命令行中添加“ 8”: 汇编:
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检查设置 干杯!     

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...