Если проблемы с установкой gem nokogiri в centos (nokogiri 1.5.9)
An error occurred while installing nokogiri (1.5.9), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.5.9'` succeeds before bundling.
[developer@001a7a453d89 website]$ gem install nokogiri -v '1.5.9'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/developer/.rbenv/versions/2.1.4/bin/ruby -r ./siteconf20141122-7926-c6afgg.rb extconf.rb
checking for libxml/parser.h... no
-----
libxml2 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.
=========================================================
=========================================================
Решение которое помогло:
# yum install libxml2 libxslt libxml2-devel libxslt-devel
=========================================================
=========================================================
=========================================================
=========================================================
=========================================================
=========================================================
=========================================================
=========================================================
$ gem install nokogiri -v '1.6.4'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/developer/.rbenv/versions/2.1.4/bin/ruby -r ./siteconf20141122-9207-1wq0ysb.rb extconf.rb
checking if the C compiler accepts ... no
Building nokogiri using packaged libraries.
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Buidling 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-unknown-linux-gnu/ports/libxml2/2.9.2... OK
Running patch with /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... ERROR, review '/home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-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}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/developer/.rbenv/versions/2.1.4/bin/ruby
--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}/lib
--enable-cross-build
--disable-cross-build
/home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.1/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError)
from /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.1/lib/mini_portile.rb:271:in `chdir'
from /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.1/lib/mini_portile.rb:271:in `execute'
from extconf.rb:297:in `block in patch'
from extconf.rb:294:in `each'
from extconf.rb:294:in `patch'
from /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.1/lib/mini_portile.rb:108:in `cook'
from extconf.rb:268:in `block in process_recipe'
from extconf.rb:167:in `tap'
from extconf.rb:167:in `process_recipe'
from extconf.rb:455:in `'
extconf failed, exit code 1
Gem files will remain installed in /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4 for inspection.
Results logged to /home/developer/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/nokogiri-1.6.4/gem_make.out
=========================================================
=========================================================
$ bundle config build.nokogiri --use-system-libraries
$ bundle install