我尝试在我的 Ubuntu 12.04 系统上安装 Nokogiri,但出现“libxslt is missing
”错误,但是 libxslt-dev
和 libxml2 -dev
已安装。
是否有可靠的安装过程?如何检查依赖库的链接?
我用的是 RVM,RVM pkg 也安装了。
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/victor/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
-----
libxslt is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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
--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=/home/victor/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--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-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-libiconv-config
--without-libiconv-config
--with-xml2lib
--without-xml2lib
--with-xsltlib
--without-xsltlib
Gem files will remain installed in /home/victor/.rvm/gems/ruby-1.9.3-p125@dradis/gems/nokogiri-1.5.4 for inspection.
Results logged to /home/victor/.rvm/gems/ruby-1.9.3-p125@dradis/gems/nokogiri-1.5.4/ext/nokogiri/gem_make.out
enter code here
最佳答案
我也遇到了与 rvm 相同的问题,即使我按照文档执行了以下操作:
-
sudo apt-get install libxslt-dev libxml2-dev
-
rvm pkg libxml2
和rvm pkg libxslt
经过长时间的调查,我唯一能解决这个问题的方法是:
- 卸载 ruby 安装:
rvm remove 1.9.3
- 删除所有
libxslt*
和libxml2*
来自~/.rvm/usr/lib
的库如果你以前做过rvm pkg ...
- 重新安装 ruby :
rvm install 1.9.3
在 apt-get
之后 重新安装命令似乎是让它工作的唯一方法。此外,确保使用 rvm pkg
安装的库不要干涉帮助。
当一切都失败了...
如果一切都失败了并且你确实需要安装 gem,你也可以重建 nokogiri
通过应用一个简单的补丁——前提是你已经安装了所有构建工具,并且需要注意的是这将安装最新的和可能不稳定的代码:
-
git clone git://github.com/sparklemotion/nokogiri
- 获取补丁 from this gist并将其保存为
x86_64.patch
在nokogiri
文件夹。 - 应用补丁:
patch -p1 < x86_64.patch
- 重建:
rake native gem
— 这应该在pkg/
中构建 gem文件夹 - 使用
gem install pkg/nokogiri-<version>-x86_64-linux.gem
安装 gem
关于ruby - Nokogiri(在 Ubuntu 上)的可靠安装过程是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11022701/