Nokogiri. libiconv is missing. Homebrew 10.9.

591 views
Skip to first unread message

Chevy Hungerford

unread,
Jun 15, 2014, 11:18:45 AM6/15/14
to nokogi...@googlegroups.com
I am having quite a few problems with this install. I went through your instructions with the homebrew 10.9 installation but I am having no success. My first problem arrives when I try the command: 

brew link libxml2 libxslt 

I get the errors: 

Warning: libxml2 is keg-only and must be linked with --force
Note that doing so can interfere with building software.
Warning: libxslt is keg-only and must be linked with --force
Note that doing so can interfere with building software.

Okay. I do not know what that means but I see that they are installed and in the proper folders. So I continue on to install libiconv. Libiconv looks like it is successful and I see it has a folder in Cellar. then I try the command:

sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

and I have no success with the installation of nokogiri. This is the error that gets outputted:

ERROR:  Error installing nokogiri:

ERROR: Failed to build gem native extension.


    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

Building nokogiri using packaged libraries.

checking for iconv.h... yes

checking for iconv_open() in iconv.h... no

checking for iconv_open() in -liconv... no

checking for libiconv_open() in iconv.h... no

checking for libiconv_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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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 /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.2.1 for inspection.

Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.2.1/gem_make.out

I have been searching stackoverflow for a reason but have had no success. Please help.

Davis W. Frank

unread,
Jun 21, 2014, 6:03:39 PM6/21/14
to nokogi...@googlegroups.com
I'm seeing similar issues.
  • Mavericks (10.9.3)
  • Xcode 5.1.1 w/ command line tools
  • Updated homebrew
  • Installed libxml2 libxslt via homebrew
  • installed iconv per Nokogiri installation
  • I forced brew link
  • rbenv
With all of that, a bundle install gives me:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.


    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 

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... yes

checking for xmlParseDoc() in -lxml2... 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.

So for some reason, libxml2 can't be found? Or some include path is wrong?

It looks like homebrew is installing libxml2 2.9.1: /usr/local/Cellar/libxml2/2.9.1

Any thoughts?

Davis W. Frank

unread,
Jun 22, 2014, 4:59:36 PM6/22/14
to nokogi...@googlegroups.com
I have a solution.
  • I've moved from rbenv back to rvm
  • I'm now using rvm gemsets
  • I've verified that libxml2 and libxslt were installed
  • This appears to be the fix - which feels somewhat obvious:

bundle config nokogirl --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28a

It seems that the system iconv was found (I think)

--dwf

Mike Dalessio

unread,
Nov 23, 2014, 7:25:27 PM11/23/14
to nokogiri-talk
FWIW, the docs at http://www.nokogiri.org/tutorials/installing_nokogiri.html should reflect current easiest-path to installing Nokogiri on OSX.

If you have other pointers, these docs are open-source at https://github.com/sparklemotion/nokogiri.org-tutorials

Cheers,
-mike


--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at http://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages