I've been experiencing a lot of problems with this gem, so I read that I had to use de 1.5.0-beta.
Since I'm using windows, I downloaded DevKit. But when I ran:
gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib
I get:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb --with-xml2-lib --with-xslt-lib --pla
taform=ruby
*** 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=C:/Ruby187/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=${xml2-dir}/lib
C:/Ruby187/lib/ruby/1.8/mkmf.rb:1177:in `dir_config': private method `split' cal
led for true:TrueClass (NoMethodError)
from extconf.rb:87
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.
5.0.beta.4 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/nokogiri-1.5.0.beta.4/ext/no
kogiri/gem_make.out
What can I do?
With a command like
gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib
it looks like you're trying to install the very latest version of nokogiri. Try specifying a precise version with --version.
Also note the following requirements for nokogiri 1.6+
ruby 1.9.3 or higher
in Nokogiri 1.6.0 and later, libxml2 and libxslt are no longer requirements
So, if you do want to use ruby 1.8.7 (which is EOL, btw) then, yes, you do need to specify nokogiri < 1.6. However, if you can use a modern, living ruby, then you might dodge the lib dependencies.
Related
I'm trying to build my first application in Ruby on Rails, but when I run bundle install I get this message:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20150921-23095-eac5m6.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using
packaged libraries. checking for gzdopen() in -lz... no zlib is
missing; necessary for building libxml2
*** 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/bin/ruby2.1
--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
extconf failed, exit code 1
Gem files will remain installed in
/tmp/bundler20150921-23095-1bpxdrp/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2
for inspection. Results logged to
/tmp/bundler20150921-23095-1bpxdrp/nokogiri-1.6.6.2/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out
An error occurred while installing nokogiri (1.6.6.2), and Bundler
cannot continue. Make sure that `gem install nokogiri -v '1.6.6.2'`
succeeds before bundling.
I tried to install Nokogiri using:
gem install nokogiri -v 1.6.6.2
but got this message:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.1.0 directory.
I also tried to run:
sudo gem install nokogiri -v 1.6.6.2
but got this message:
Building native extensions. This could take a while... ERROR: Error
installing nokogiri: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20150921-24140-1odizm6.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using
packaged libraries. checking for gzdopen() in -lz... no zlib is
missing; necessary for building libxml2
*** 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/bin/ruby2.1
--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
extconf failed, exit code 1
Gem files will remain installed in
/var/lib/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection. Results
logged to
/var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out
I'm new to Ubuntu and Ruby on Rails. How can I solve these problems?
It looks like you're missing prerequisites.
Nokogiri's "Troubleshooting Ubuntu/Debian Installation" documentation says:
Here’s what you should do if you should find yourself in this situation:
1 sudo apt-get install ruby-dev zlib1g-dev
Please report it as a bug if this doesn’t work for you (see Getting Help for details).
Because you're using Ubuntu and doing a normal install, you'll need sudo to do any gem installs.
I'd strongly recommend using rbenv or RVM to manage your Ruby installation(s) as they'll make your life a lot easier. If you use those, you won't need to use sudo again, except for any system-wide prerequisite libraries.
I'm trying to install Ruby on my Windows environment. It works fine on my Ubuntu.
I followed the instructions here: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Ruby 2.0 seems to be correctly set, both DevKit and RubyInstaller.
But when I try to bundle ig Get the following:
gem install nokogiri -v '1.5.11'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
C:/Ruby/RubyInstaller200-x64/bin/ruby.exe extconf.rb
Le chemin d'accès spécifié est introuvable.
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.
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=C:/Ruby/RubyInstaller200-x64/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-pkg-config
--without-pkg-config
--with-libiconv-config
--without-libiconv-config
--with-pkg-config
--without-pkg-config
Gem files will remain installed in C:/Ruby/RubyInstaller200-x64/lib/ruby/gems/2.0.0/gems/nokogiri-1.5.11 for inspection.
Results logged to C:/Ruby/RubyInstaller200-x64/lib/ruby/gems/2.0.0/gems/nokogiri-1.5.11/ext/nokogiri/gem_make.out
I already have this gem installed, but in another version.
C:\wamp\www\holdsport>gem list | grep noko
nokogiri (1.6.2.1 x64-mingw32)
It seems like libxml2 isn't installed but I couldn't find out how install it on windows.
I don't know if the message extconf.rb failed is because the libxml2 is missing or another issue.
Any idea why it doesn't work?
Nokogiri doesn't support x64 ruby 2.0, for whatever reason. Try installing the x86 version of ruby instead.
If gem install nokogiri still doesn't work, install the pre-release with gem install nokogiri --pre.
I am trying to install the rubber gem. A couple days ago, I was fooling around with Nokogiri, but couldn't get it properly installed. I forgot about it because it was not pressing. Well now I am trying to install the rubber gem and am getting these errors that confuse me and they seem to be related to Nokogiri, which is not installed to my knowledge. Help me out, thank you.
#THRILLHO:~$ gem install rubber
Building native extensions. This could take a while...
ERROR: Error installing rubber:
ERROR: Failed to build gem native extension.
/home/noonan/.rvm/rubies/ruby-1.9.3-p327/bin/ruby 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.
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/noonan/.rvm/rubies/ruby-1.9.3-p327/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
Gem files will remain installed in /home/noonan/.rvm/gems/ruby-1.9.3-p327/gems/nokogiri-1.5.6 for inspection.
Results logged to /home/noonan/.rvm/gems/ruby-1.9.3-p327/gems/nokogiri-1.5.6/ext/nokogiri /gem_make.out
Do this: sudo apt-get install libxslt-dev libxml2-dev and then install rubber again
The error message is very clear: libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
When I try to run a ruby on rails project I got an error:
An error occurred while installing nokogiri (1.5.2), and bundle cannot continue.
Make sure that 'gem install nokogiri -v 1.5.2 succeed before building.
I'm working on Ubuntu 10.10
My co-worker uses on Windows/RVM and does not have this problem.
Edit:
gem_make.out
/opt/bitnami/ruby/bin/ruby extconf.rb
extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.
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... no
checking for iconv_open() in -liconv... no
-----
libiconv 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
--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=/opt/bitnami/ruby/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-iconvlib
--without-iconvlib
From the output:
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
Install libiconv.
nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
You can visit http://nokogiri.org/tutorials/installing_nokogiri.html
It should not be necessary to install any additonal package. You can use the libraries includes with BitNami (in /opt/bitnami/common). You just need to load the BitNami environment and specify the path to libxml2 files. While testing this I got similar issue but with libxml2, a similar solution can be applied for the iconv error that you are receiving.
$/opt/bitnami/rubyconsole
$sudo gem install nokogiri -- --with-xml2-dir=/opt/bitnami/common --with-xml2-include=/opt/bitnami/common/include/libxml2
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.2
1 gem installed
Installing ri documentation for nokogiri-1.5.2...
Installing RDoc documentation for nokogiri-1.5.2...
The solution of installing the system packages and used them should also work.
what works for me (Mac OS X):
$ xcode-select --install
I was trying to install webrat on my Mac, but I've got the error, that the iconv.h is missing. Here is the log:
Building native extensions. This could take a while...
ERROR: Error installing webrat:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... no
iconv is missing. try 'port install iconv' or 'yum install iconv'
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--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
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out
The weird thing is, that the iconv.h is already in the /opt/local/include/ directory.
Can anyone recommend a solution?
thx,
tux
Ok, I solved it on my own.
After a couple of days on research and trying I figured out, that my installation of g++ and gcc was broken. I've installed an update of g++ through macports, and in the .profile file of my current user there was a value in the PATH var from macports. I removed it, and now it works.
The PATH var should look like this:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
More help on Nokogiri website, using macports or homebrew for Mac OS X install:
http://nokogiri.org/tutorials/installing_nokogiri.html
For iconv related problems, please refer to this issue on github:
https://github.com/tenderlove/nokogiri/issues/381