Nokogiri(在 Ubuntu 上)的强大安装过程是什么? [英] What is a robust installation process for Nokogiri (on Ubuntu)?
问题描述
我尝试在我的 Ubuntu 12.04 系统上安装 Nokogiri,并得到一个错误消息libxslt is missing
",但是 libxslt-dev
和 libxml2-dev
已安装.
I tried to install Nokogiri on my Ubuntu 12.04 system, and got an error that said "libxslt is missing
", but the libxslt-dev
and libxml2-dev
are installed.
是否有可靠的安装过程?如何检查依赖库的链接?
Is there a robust installation process? How can I check the links to dependent libraries?
我使用了 RVM,并且也安装了 RVM pkg.
I used RVM, and the RVM pkg is installed too.
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 相同的问题,尽管我按照文档做了以下操作:
I have also experienced the same problem with rvm, even though I had done the following, as per documentation:
sudo apt-get install libxslt-dev libxml2-dev
rvm pkg libxml2
和rvm pkg libxslt
经过长时间的调查,我能解决这个问题的唯一方法是:
The only way I could get this solved was, after a lengthy investigation:
- 卸载ruby安装:
rvm remove 1.9.3
- 如果您以前做过
rvm,请从
~/.rvm/usr/lib
中删除所有libxslt*
和libxml2*
库pkg ... - 重新安装 ruby:
rvm install 1.9.3
- Uninstall the ruby installation:
rvm remove 1.9.3
- Delete all
libxslt*
andlibxml2*
libs from~/.rvm/usr/lib
if you had previously donervm pkg ...
- Reinstall ruby:
rvm install 1.9.3
在apt-get
命令之后重新安装 似乎是让它工作的唯一方法.此外,确保使用 rvm pkg
安装的库不会干扰也有帮助.
Reinstalling after the apt-get
commands seems to be the only way of getting this to work. Also, ensuring the libs installed with rvm pkg
don’t interfere helped.
当其他一切都失败时...
如果其他一切都失败了并且您绝对需要安装 gem,您还可以通过应用一个简单的补丁来重建 nokogiri
— 前提是您已安装所有构建工具,并注意这将安装最新且可能不稳定的代码:
If everything else fails and you absolutely need the gem installed, you can also rebuild nokogiri
by applying a simple patch — provided that you have all build tools installed, and with the caveat that this will install the latest and potentially unstable code:
git clone git://github.com/sparklemotion/nokogiri
- 获取补丁从此要点并将其保存为
x86_64.patch
nokogiri
文件夹. - 应用补丁:
patch -p1 <;x86_64.patch
- 重建:
rake native gem
— 这应该在pkg/
文件夹中构建 gem - 使用
gem install pkg/nokogiri-
-x86_64-linux.gem 安装 gem
git clone git://github.com/sparklemotion/nokogiri
- get patch from this gist and save it as
x86_64.patch
in thenokogiri
folder. - Apply patch:
patch -p1 < x86_64.patch
- Rebuild:
rake native gem
— this should build the gem in thepkg/
folder - Install the gem using
gem install pkg/nokogiri-<version>-x86_64-linux.gem
这篇关于Nokogiri(在 Ubuntu 上)的强大安装过程是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!