2011-09-14 30 views
5

我目前正試圖安裝一個紅寶石,因爲extconf說它需要libxml,所以當我按照these指示安裝libxml(其中包括these爲Ruby開發工具包安裝)我得到以下輸出說明:如何安裝紅寶石gem libxml沒有'extconf失敗:需要libxml2'

$ gem install libxml-ruby --platform x86-mswin32-60 
Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
ERROR: Error installing libxml-ruby: 
    ERROR: Failed to build gem native extension. 

    c:/Ruby/bin/ruby.exe extconf.rb 
checking for socket() in -lsocket... no 
checking for gethostbyname() in -lnsl... no 
checking for atan() in -lm... yes 
checking for inflate() in -lz... no 
checking for inflate() in -lzlib... no 
checking for inflate() in -lzlib1... yes 
checking for iconv_open() in -liconv... no 
checking for libiconv_open() in -liconv... yes 
checking for xmlParseDoc() in -lxml2... no 
checking for xmlParseDoc() in -llibxml2... no 
checking for xmlParseDoc() in -lxml2... no 
*** 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 
--8<-- 
    --with-xml2lib 
    --without-xml2lib 
extconf failure: need libxml2. 

Install the library or try one of the following options to extconf.rb: 

    --with-xml2-config=/path/to/xml2-config 
    --with-xml2-dir=/path/to/libxml2 
    --with-xml2-lib=/path/to/libxml2/lib 
    --with-xml2-include=/path/to/libxml2/include 

Gem files will remain installed in c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2 for inspection. 
Results logged to c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2/ext/libxml/gem_make.out 

我是在Windows 7 X64的安裝使用我MINGW32殼/ git的安裝。安裝失敗時,從窗口的紅寶石增強命令promt相同的消息。

FWIW:

$ ruby -v 
ruby 1.9.2p290 (2011-07-09) [i386-mingw32] 

$ git --version 
git version 1.7.6.msysgit.0 

$ gem -v 
1.8.10 
+0

回答這個問題解決了這個問題:HTTP ://stackoverflow.com/questions/2915788/libxml-ruby-failed-to-load-at-x86-64 – Zaz

+0

我錯過了這個意見。您應該將此鏈接發佈爲答案,以便其他人可以輕鬆查看答案。 – Kelvin

回答

0

嘗試運行

yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel 

比它應該工作

+0

OP明確表示他在窗口上 – Fitzsimmons

+0

對我仍然有用谷歌搜索。謝謝。 – penner

+0

在Ubuntu上,它是'sudo apt-get install libxml2-dev' –

1

你應該嘗試,而不是使用libxml-rubynokogiri寶石。它包含預編譯的libxml2 dll作爲安裝的一部分,因此您不必擔心自己構建它。

引入nokogiri的API是的libxml-紅寶石的不同,但我敢肯定你會發現相同的功能。

如果libxml的,紅寶石是另一種寶石或應用程序的依賴,你可能無法使用引入nokogiri。你想做什麼?

+0

就是這樣!很好的回答,不需要'yum'或'apt-get' ... –