Incompatible library version: nokogiri.bundle requ

2019-03-16 16:39发布

问题:

In an attempt to get mysql installed on my mac for a rails project I followed an online suggestion of installing homebrew and removing mac ports. This is where the problems began. The rails project won't build, I am getting this:

[rake --prereqs] rake aborted!

dlopen(/Users/Parker/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle, 9):

Library not loaded: /opt/local/lib/libiconv.2.dylib

Referenced from: /Users/Parker/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle

Reason: Incompatible library version: nokogiri.bundle requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0

/Users/Parker/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle /Users/Parker/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'

...

I've tried the suggest of running

brew install libiconv

to which I receive the message:

Error: No available formula for libiconv Apple distributes libiconv with OS X, you can find it in /usr/lib. Some build scripts fail to detect it correctly, please check existing formulae for solutions.

I've also tried

gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1

to which I receive:

ERROR: Error installing nokogiri:

ERROR: Failed to build gem native extension.

/Users/Parker/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.8.0... OK

Running 'configure' for libxml2 2.8.0... OK

Running 'compile' for libxml2 2.8.0... OK

Running 'install' for libxml2 2.8.0... OK

Activating libxml2 2.8.0 (from /Users/Parker/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12.5.0/libxml2/2.8.0)...

Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxslt/1.1.26... OK

Running 'configure' for libxslt 1.1.26... OK

Running 'compile' for libxslt 1.1.26... OK

Running 'install' for libxslt 1.1.26... OK

Activating libxslt 1.1.26 (from /Users/Parker/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.26)...

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=/Users/Parker/.rvm/rubies/ruby-2.0.0-p247/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 --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-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 /Users/Parker/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0 for inspection.

Results logged to /Users/Parker/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out

I have worked to resolve this issue for well over 8 hours. I have tried every link and every suggest google supplies me with. I am completely stumped. It seems to me I'm in over my head and have caused some environment issues. I realize more information is probably needed, but I don't know what to supply. Please let me know what other information would help diagnose the problem.

回答1:

I finally found a combination of suggestions that resolved my issue:

http://www.rqna.net/qna/swryr-bundle-install-stopped-at-nokogiri.html

brew tap homebrew/dupes

then:

brew install libiconv

brew link --force libiconv

Apparently 'brew tap homebrew/dupes' allowed me to use the 'brew install libiconv' without an error, and from there the 'brew link --force libiconv' remedied the issue.