ruby-on-rails - Nokogiri osx 10.5.8 libxml不兼容的库版本

标签 ruby-on-rails nokogiri libxml2

我在这里遇到了一个绊脚石,试图让Nokogiri在osx 10.5.8上工作。

尝试过http://nokogiri.org/tutorials/installing_nokogiri.html
然后http://martinisoftware.com/2009/07/31/nokogiri-on-leopard.html

一位同事也一直在尝试提供帮助,但无法摆脱此错误消息:

库未加载:/usr/local/lib/libxml2.2.dylib
...
原因:库版本不兼容:nokogiri.bundle需要版本11.0.0或更高版本,但是libxml2.2.dylib提供了版本10.0.0。

我们尝试使用新安装的库来编译gem,但仍然遇到此错误。

任何帮助或指针真的很感激!

我得到了osx 10.6的副本-这能帮上忙吗?

谢谢

最佳答案

实际上,答案是:http://nokogiri.org/tutorials/installing_nokogiri.html

brew install libxml2 libxslt
brew link libxml2 libxslt

然后从源代码安装libiconv:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install

然后(最终)安装nokogiri:
gem install nokogiri --
                    --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 
                    --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib 
                    --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 
                    --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include 
                    --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

确保拥有/usr/local/Cellar/libxml中的libxml2版本(在我的情况下为2.8.0)。

祝您编码愉快!

关于ruby-on-rails - Nokogiri osx 10.5.8 libxml不兼容的库版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11298553/

相关文章:

linux - libxml2.so.2 : cannot open shared object file: No such file or directory

ruby-on-rails - Rmagick SVG 转换不同于 ImageMagick

ruby-on-rails - 我需要在 rails 路线前加斜杠吗

mysql - rails : order query by has and belongs to many presence

ruby - 为什么我可以在 Windows 7 中编译和安装 Nokogiri,但不能要求它?

ruby-on-rails - 如何使用正则表达式模式从 URL 中提取参数

windows - 如何在 Windows 上使用 Jruby 的 nokogiri?

ruby-on-rails - 蓝图 css rails 3.1 帮助

ruby-on-rails - 使用 Babun 安装 nokogiri 1.6.6.2 出现错误 'libxml2 version 2.6.21 or later is required!'

python libxml2序列化问题