Below is what I tried on my CentOS6.5 server. I have already updated Git and Ruby, but still can't get it to install. The first section is where I tried to install it as a sudo user. The second section is when I Tried to install it by root.
Can anyone offer other ideas on how to fix this? I am having a hard time finding any fixes for this issue.
Section 1:
[user@server gitlab-rails]$ sudo gem install nokogiri -- --use-system-libraries
[sudo] password for user:
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2.
[user@server gitlab-rails]$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Section 2:
[root@server gitlab-rails]# gem install nokogiri -- --use-system-libraries
Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/usr/local/bin/ruby
--help
--clean
--use-system-libraries
--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-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--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-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config
--without-libexslt-config
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/nokogiri-1.6.6.2/gem_make.out
yum install libxslt-devel libxml2-devel
bundle config build.nokogiri --use-system-libraries
bundle install
These error messages appear to me to be pretty clear-cut: you're using an old ruby in the first instance (and running into Rubygems behavior (not Nokogiri behavior)), and trying to link to an old (known-buggy) version of libxml2 in the second (this is Nokogiri's sanity check).
If you want to "fix" it, make sure you're using the right Ruby version, and either install an acceptable libxml2 or let Nokogiri use its vendored versions for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With