2011-05-24 106 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),