1
我正在嘗試安裝nokogiri 1.6.0版,並且有一些問題。Gem安裝忽略nokogiri的標誌
$ gem install nokogiri -v '1.6.0' -- --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
Building native extensions with: '--with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28'
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/shamatov/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
Extracting libxml2-2.8.0.tar.gz into tmp/i686-apple-darwin11/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/shamatov/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/i686-apple-darwin11/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /Users/shamatov/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxslt/1.1.26)...
checking for libxml/parser.h... *** 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.
正如你所看到的,我用:--with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
但extconf.rb使用libxml2-2.8.0.tar.gz 同爲XSLT它使用的libxslt-1.1.26.tar.gz
如何解決這個問題,導致改變版本實際上不是一個選項? 感謝
謝謝,太棒了。你能解釋它是如何工作的嗎?爲什麼我的版本不正確 – 2014-10-31 13:50:20
我還沒有記住在Mac上編譯捆綁的lib [xml,xslt]庫時出現了什麼問題,但是在安裝nokogiri時應該始終打開「NOKOGIRI_USE_SYSTEM_LIBRARIES = 1」標誌。 Nokogiri對於什麼庫完全適合你的系統做出了一些奇怪的假設,並且總是失敗:)不用說,如果沒有該標誌,它會嘗試使用捆綁的庫。 – mudasobwa 2014-10-31 14:01:09