8

升級到雪豹後,我發現,不再安裝某些寶石的工作,包括webrat,機械化等。每次我得到這個錯誤:錯誤在Snow Leopard上安裝某些寶石 - libxml2的

checking for xmlParseDoc() in -lxml2... no 
libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

而且沒有,我還沒有嘗試使用macports安裝它,因爲我發現幾年前我發現無法輕鬆降級/管理端口,所以我退出了macports。從那以後,我從一個人手中變得非常舒適,這是我第一次碰到超出我的範圍的東西。我很樂意被說服回到m​​acports,但前提是沒有簡單的解決方案來解決這個問題。

它不會出現libxml2的實際缺失,只是過時了吧?...

擴展輸出

ERROR: Failed to build gem native extension. 

/usr/local/bin/ruby extconf.rb 
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for xmlParseDoc() in -lxml2... no 
libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/local/bin/ruby 
    --with-iconv-dir 
    --without-iconv-dir 
    --with-iconv-include 
    --without-iconv-include=${iconv-dir}/include 
    --with-iconv-lib 
    --without-iconv-lib=${iconv-dir}/lib 
    --with-xml2-dir 
    --without-xml2-dir 
    --with-xml2-include 
    --without-xml2-include=${xml2-dir}/include 
    --with-xml2-lib 
    --without-xml2-lib=${xml2-dir}/lib 
    --with-xslt-dir 
    --without-xslt-dir 
    --with-xslt-include 
    --without-xslt-include=${xslt-dir}/include 
    --with-xslt-lib 
    --without-xslt-lib=${xslt-dir}/lib 
    --with-xml2lib 
    --without-xml2lib 


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1 for inspection. 
Results logged to /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out 

回答

1

UPDATE

正如另一個答案所述,下面的解決方案是「矯枉過正」,因爲它從你的系統,我認爲我已經做得比較早的MacPorts刪除。仔細處理。可能有一種方法可以使用MacPorts來更新libxml2安裝。


我解決了這個問題(至少在我的機器上)。

一旦我意識到該跟蹤中沒有任何內容表明缺少libxml2,而是在檢測到版本時出現問題,我環顧四周以確認這一事實。果然,nokogiri website(許多類似的錯誤報告指出了我)毫不含糊地指出Snow Leopard提供了一個良好的libxml2工作版本。

因此,我推斷我很早以前就已經用另一種方法安裝了一個版本。我會記得如果我手動安裝,所以實際上只剩下一個選項,frickin'macports。

$ libxml2-2.7.1 tfwright$ sudo find/-type d -name "libxml2" 
find: /dev/fd/3: Not a directory 
find: /dev/fd/4: Not a directory 
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/libxml2 
/Developer/SDKs/MacOSX10.5.sdk/usr/include/libxml2 
/Developer/SDKs/MacOSX10.6.sdk/usr/include/libxml2 
/opt/local/include/libxml2 
/opt/local/share/gtk-doc/html/libxml2 
/opt/local/var/macports/distfiles/libxml2 
/opt/local/var/macports/receipts/libxml2 
/opt/local/var/macports/software/libxml2 
/opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/include/libxml2 
/opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/share/gtk-doc/html/libxml2 
/opt/local/var/macports/sources/rsync.macports.org/release/ports/textproc/libxml2 
/usr/include/libxml2 
/usr/share/gtk-doc/html/libxml2 

兒子的...只是吹走/opt/local/var/macports,這是我第一次嘗試的是,似乎沒有解決這個問題,所以我去了big guns

sudo rm -rf \ 
/opt/local \ 
/Applications/DarwinPorts \ 
/Applications/MacPorts \ 
/Library/LaunchDaemons/org.macports.* \ 
/Library/Receipts/DarwinPorts*.pkg \ 
/Library/Receipts/MacPorts*.pkg \ 
/Library/StartupItems/DarwinPortsStartup \ 
/Library/Tcl/darwinports1.0 \ 
/Library/Tcl/macports1.0 \ 
~/.macports 

之後,一切安裝正常。那就對了。永遠不要相信錯誤消息的建議!遠不需要使用macports重新安裝libxml2,我需要擦除我的系統中的所有macports痕跡,這些痕跡讓我難以理解垃圾。

+0

感謝@floyd也爲我工作 – 2012-12-20 09:10:32

0

你要安裝的libxml2需要的寶石。如果您願意從源代碼安裝,請安裝libxml2

您可能會遇到依賴性問題,其中libxml2依賴於您需要手動構建和安裝的一堆其他包。這是macport最終變得有用的原因之一。

+0

我超越了我肯說,因爲沒有按似乎沒有任何從源代碼安裝libxml2的權威指南。而根據我的經驗,在沒有一些指導的情況下,有太多隱藏的陷阱可以冒險。你提到的依賴問題正是我所說的。你是否說在這種情況下有太多的依賴關係,制定一個簡單的配方是不合理的,比如SQL,ruby等存在的那些(hivelogic指南)? – tfwright 2010-01-16 01:32:31

1

floyd的解決方案是過度殺傷 - 我有同樣的問題,並開始nucking一些相同的/ opt /本地文件與xml2相關,但他的'find'命令不顯示opt/local/lib中的實際libxml2文件。這可能是你只需要核武器。

這裏是我的核爆文件:

/opt/local/include/libxml2 
/opt/local/var/db/dports/distfiles/libxml2 
/opt/local/var/db/dports/receipts/libxml2 
/opt/local/var/db/dports/software/libxml2 
/opt/local/var/db/dports/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2 
/opt/local/share/gtk-doc/html/libxml2 
/opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2 

,但你嘗試之前 - 只是核彈LIB文件 須藤RM /opt/local/lib/libxml2.*

當我試圖安裝之後,它鑽進編譯這一切,但隨後barfed與libz進行的一個問題...

所以核彈是在/ opt/local/lib目錄 須藤室射頻/opt/local/lib/libz.*

它編譯得很好!

所以要儘量的摧毀到/ opt/local/lib目錄的libxml2。*和libz進行。*文件,看它是否編譯,如果沒有,核彈到/ opt /本地/包括