2016-03-01 65 views
-1

我正在安装Nokogiri宝石bundle install,但在CentOS 6.6中出现以下错误。我也安装了libxml2,libxslt。未能安装宝石Nokogiri-1.6.6.2

Building native extensions. This could take a while... 
ERROR: Error installing nokogiri-1.6.6.2.gem: 
ERROR: Failed to build gem native extension. 

/usr/bin/ruby -r ./siteconf20160301-19713-3tkoho.rb extconf.rb 
checking if the C compiler accepts ... yes 
Building nokogiri using packaged libraries. 
checking for gzdopen() in -lz... yes 
checking for iconv... yes 
************************************************************************ 
IMPORTANT NOTICE: 

Building Nokogiri with a packaged version of libxml2-2.9.2 
with the following patches applied: 
     - 0001-Revert-Missing-initialization-for-the-catalog-module.patch 
     - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch 

Team Nokogiri will keep on doing their best to provide security 
updates in a timely manner, but if this is a concern for you and want 
to use the system library instead; abort this installation process and 
reinstall nokogiri as follows: 

    gem install nokogiri -- --use-system-libraries 
     [--with-xml2-config=/path/to/xml2-config] 
     [--with-xslt-config=/path/to/xslt-config] 

If you are using Bundler, tell it to use the option: 

    bundle config build.nokogiri --use-system-libraries 
    bundle install 

Note, however, that nokogiri is not fully compatible with arbitrary 
versions of libxml2 provided by OS/package vendors. 
************************************************************************ 

Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2... OK 
Running patch with /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch... 
Running 'patch' for libxml2 2.9.2... ERROR, review '/usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2/patch.log' to see what happened. 
*** 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 
     --without-opt-dir 
     --with-opt-include 
     --without-opt-include=${opt-dir}/include 
     --with-opt-lib 
     --without-opt-lib=${opt-dir}/lib64 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=/usr/bin/$(RUBY_BASE_NAME) 
     --help 
     --clean 
     --use-system-libraries 
     --enable-static 
     --disable-static 
     --with-zlib-dir 
     --without-zlib-dir 
     --with-zlib-include 
     --without-zlib-include=${zlib-dir}/include 
     --with-zlib-lib 
     --without-zlib-lib=${zlib-dir}/lib64 
     --enable-cross-build 
     --disable-cross-build 
/usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError) 
     from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir' 
     from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute' 
     from extconf.rb:311:in `block in patch' 
     from extconf.rb:308:in `each' 
     from extconf.rb:308:in `patch' 
     from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in `cook' 
     from extconf.rb:278:in `block in process_recipe' 
     from extconf.rb:177:in `tap' 
     from extconf.rb:177:in `process_recipe' 
     from extconf.rb:475:in `<main>' 

extconf failed, exit code 1 

Gem files will remain installed in /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection. 
Results logged to /usr/lib64/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out 
[[email protected] gemfiles]# 
+0

很难用这种格式来阅读你的问题。你有没有尝试过使用nokogiri的github版本?或者至少要做日志建议你的事情? – taglia

+0

gem install nokogiri-1.6.6.2在centos 6.6中失败,但使用bundle安装(当我将nokogiri放入Gemfile时)。 –

+0

在gemfile中,尝试用'gem'nokogiri'替换,github:'sparklemotion/nokogiri'' – taglia

回答

0

修复了安装rvm(ruby版本管理器)的问题。