Trying to install rubber gem, Nokogiri messing it up? - ruby-on-rails

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.

Related

Nokogiri installation fails libxslt is missing

I am sorry but I think I try everything I have seen on the internet to make it works but it always fails :(
I have to work on an old rails project with ruby 2.1.10 and when I bundle update the nokogiri '1.6.3.1' build fail.
It work's well with ruby 2.6.6 and nokogiri-1.10.10
I have install libxml2 and libxsl with homebrew xcode is install and I have read and agreed on the license
I try to install nokogiri link that
gem install nokogiri -v '1.6.3.1' -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 --with-xslt-include=$(brew --prefix libxslt)/include/libxslt
and this is the output
Building native extensions with: '--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-include=/usr/local/opt/libxslt/include/libxslt'
This could take a while...
Building nokogiri using system libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/lokhi/.rbenv/versions/2.1.10/bin/ruby extconf.rb --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-include=/usr/local/opt/libxslt/include/libxslt
Building nokogiri using system libraries.
libxml2 version 2.9.0 and later is not yet supported, but proceeding anyway.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... no
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... 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
--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=/Users/lokhi/.rbenv/versions/2.1.10/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=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--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
--with-pkg-config
--without-pkg-config
--with-xsltlib
--without-xsltlib
--with-libxsltlib
--without-libxsltlib
extconf failed, exit code 1
Gem files will remain installed in /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-19/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
I have try with nothing
gem install nokogiri -v '1.6.3.1'
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/lokhi/.rbenv/versions/2.1.10/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
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=/Users/lokhi/.rbenv/versions/2.1.10/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
extconf failed, exit code 1
Gem files will remain installed in /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-19/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
and with only
gem install nokogiri -v '1.6.3.1' -- --use-system-libraries
Building native extensions with: '--use-system-libraries'
This could take a while...
Building nokogiri using system libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/lokhi/.rbenv/versions/2.1.10/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.9.0 and later is not yet supported, but proceeding anyway.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... no
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... 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
--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=/Users/lokhi/.rbenv/versions/2.1.10/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
--with-xsltlib
--without-xsltlib
--with-libxsltlib
--without-libxsltlib
extconf failed, exit code 1
Gem files will remain installed in /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-19/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
More information about my system
clang -v
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I don't know what to try now have you got an idea, please?
Thanks
EDIT add new information
ls /usr/local/share/aclocal/
README glib-2.0.m4 gsettings.m4 introspection.m4 lib-prefix.m4 ltdl.m4 lt~obsolete.m4 pkg.m4
dirlist glib-gettext.m4 host-cpu-c-abi.m4 ksba.m4 libtool.m4 ltoptions.m4 nls.m4 po.m4
freetype2.m4 gpg-error.m4 iconv.m4 lib-ld.m4 libxml.m4 ltsugar.m4 nspr.m4 progtest.m4
gettext.m4 gpgrt.m4 intlmacosx.m4 lib-link.m4 ltargz.m4 ltversion.m4 orc.m4 wxwin.m4
ls /usr/local/opt/libxml2/share/aclocal/
libxml.m4
cat /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-19/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
/Users/lokhi/.rbenv/versions/2.1.10/bin/ruby extconf.rb --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-include=/usr/local/opt/libxslt/include/libxslt
Building nokogiri using system libraries.
libxml2 version 2.9.0 and later is not yet supported, but proceeding anyway.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... no
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... 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
--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=/Users/lokhi/.rbenv/versions/2.1.10/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=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--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
--with-pkg-config
--without-pkg-config
--with-xsltlib
--without-xsltlib
--with-libxsltlib
--without-libxsltlib
extconf failed, exit code 1
and output of mkmf.log
_Nonnull
conftest.c:15:15: error: implicit declaration of function 'xsltParseStylesheetDoc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int t(void) { xsltParseStylesheetDoc(); return 0; }
^
194 warnings and 1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxslt/xslt.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: int t(void) { xsltParseStylesheetDoc(); return 0; }
/* end */
After libxml2 downgrade
This could take a while...
Building nokogiri using system libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/lokhi/.rbenv/versions/2.1.10/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... no
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... 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
--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=/Users/lokhi/.rbenv/versions/2.1.10/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
--with-xsltlib
--without-xsltlib
--with-libxsltlib
--without-libxsltlib
extconf failed, exit code 1
Gem files will remain installed in /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/lokhi/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-19/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
and exactly same output for mkmf.log
#EDIT#
Nokogiri has a tutorial about installing on MacOS:
https://nokogiri.org/tutorials/installing_nokogiri.html#macos
Can you try the steps in that document?
old information:
as per: libxml2 and libxml2-dev on OSX
brew link --force libxml2
or possibly:
ln -s /usr/local/opt/libxml2/share/aclocal/libxml.m4 /usr/local/share/aclocal/libxml.m4
I see you already have installed libxml2, also try installing libxslt, libxslt-devel and I think there was also a dependency to openssl-devel at some point.

Nokogiri gem failing to install

I'm trying to install nokogiri v 1.6.7.2 in a new rails project. I'm running Kali Linux (debian-based). Here is the stack trace:
$ gem install nokogiri -v '1.6.7.2' -- --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/bin/ruby2.2 -r ./siteconf20160405-3609-rdkvif.rb 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/bin/$(RUBY_BASE_NAME)2.2
--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-pkg-config
--without-pkg-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
--with-pkg-config
--without-pkg-config
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.2.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /var/lib/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/gem_make.out
I've checked I have libxml2 installed:
apt-get install libxml2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2 is already the newest version (2.9.3+dfsg1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
And I saw in other threads to try using the --use-sytem-libraries flag, but that still causes the same error. What am I missing?
Thank you!
In addition to libxml2 and libxslt, you also require some additional development libraries. Install them using sudo apt-get install ruby-dev zlib1g-dev liblzma-dev. More at https://github.com/sparklemotion/nokogiri.org-tutorials/blob/master/content/installing_nokogiri.md.

Installing Nokogiri gem on windows

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.

libxml2 missing when installing nokogiri's gem devkit (windows)

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.

Failed to install nokogiri and webrat on Mac OS X

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

Resources