1

I'm trying to use the Carrierwave gem to add pictures to my site. As soon as I use the gem uploader, I get the following error telling me that I have an incompatible library version referencing Nokogiri 1.8.1 ...

/Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.8.1/lib/nokogiri.rb:32:in `require': incompatible library version - /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.8.1/lib/nokogiri/nokogiri.bundle (fatal)
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.8.1/lib/nokogiri.rb:32:in `rescue in <top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.8.1/lib/nokogiri.rb:28:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/loofah-2.1.1/lib/loofah.rb:3:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/loofah-2.1.1/lib/loofah.rb:3:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/rails-html-sanitizer-1.0.3/lib/rails-html-sanitizer.rb:2:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/rails-html-sanitizer-1.0.3/lib/rails-html-sanitizer.rb:2:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/sanitize_helper.rb:2:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/sanitize_helper.rb:2:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/text_helper.rb:32:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/text_helper.rb:32:in `<module:TextHelper>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/text_helper.rb:29:in `<module:Helpers>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/text_helper.rb:6:in `<module:ActionView>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/text_helper.rb:4:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_tag_helper.rb:18:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_tag_helper.rb:6:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_helper.rb:4:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers/form_helper.rb:4:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers.rb:50:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers.rb:50:in `<module:Helpers>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers.rb:4:in `<module:ActionView>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.6/lib/action_view/helpers.rb:3:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/context.rb:1:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/context.rb:1:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/railtie.rb:7:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/railtie.rb:7:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/railties-5.0.6/lib/rails/all.rb:14:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/railties-5.0.6/lib/rails/all.rb:14:in `block in <top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/railties-5.0.6/lib/rails/all.rb:12:in `each'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/railties-5.0.6/lib/rails/all.rb:12:in `<top (required)>'
  from /Users/danieluribe/code/one_stop_ror/yelpdemo/config/application.rb:3:in `require'
  from /Users/danieluribe/code/one_stop_ror/yelpdemo/config/application.rb:3:in `<top (required)>'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
  from /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
  from /Users/danieluribe/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /Users/danieluribe/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Most of the solutions I've seen online include references to libxml2 but I see no references in my error to that. I have however tried the solution here with no success.

I have uninstalled and reinstalled both nokogiri and libxml multiple times using brew. I've also used the installation for Nokogiri on Mac as mentioned on their page here.

I'm not 100-percent sure if it's simply a Nokogiri error or whether libxml2 requires a different version than the default. The current version I'm using for libxml2 is 2.9.3. Any help or pointing in the right direction will be greatly appreciated. Let me know if more details are needed.

fancy_daniel
  • 87
  • 2
  • 10

1 Answers1

0

Try installing the development files if you haven't already:

sudo apt-get install g++ build-essential -y

EDIT: Oops, for mac try this: https://github.com/kennethreitz/osx-gcc-installer

EDIT: Another idea, remove Nokogiri version from the Gemfile then try

gem install nokogiri -v 1.6.8.1 -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
omikes
  • 8,064
  • 8
  • 37
  • 50
  • I was able to install the GCC compiler with brew (took about an hour) but still go the same error. – fancy_daniel Oct 28 '17 at 04:34
  • i have added an alternate solution, could you give it a try? this one assumes you have Mac OS X Sierra with Xcode installed... – omikes Oct 28 '17 at 06:04
  • Hey there, I tried uninstalling as you mentioned and added the exact line of code and I get the same error only in reference to using Nokogiri 1.6.8.1 `/Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.8.1/lib/nokogiri.rb:32:in `require': incompatible library version - /Users/danieluribe/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.8.1/lib/nokogiri/nokogiri.bundle (fatal)`. I'm also now having issues with the rails server with the exact same error so it's not liking this new version. – fancy_daniel Oct 28 '17 at 20:14
  • Just an update, I went back to reinstall Nokogiri 1.8.1 and ran bundle update. It updated Carrierwave to 1.2.1 and I specified that version in the Gemfile. And voila, the uploader started working. The documentation for Carrierwave still refers to using version 1.0 though. – fancy_daniel Oct 28 '17 at 20:30