Zedrian
Zedrian

Reputation: 909

Rails 3.2.3 Rake Cucumber: library not loaded

after updating my ruby to 1.9.3 and rails to 3.2.3 I have been trying to follow the tutorial from RailsApp Projects devise, rspec and cucumber and I have been running into a problem when trying out cucumber at the step

rake cucumber

and get a rake aborted error

dlopen(/Users/Aurelien/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.2/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: /Users/Aurelien/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.2/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/Aurelien/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.2/lib/nokogiri/nokogiri.bundle

anyone got a similar problem and found a solution it would help a lot. The current gem file:

gem 'rails', '3.2.3'
gem 'sqlite3'
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem "rspec-rails", ">= 2.9.0.rc2", :group => [:development, :test]
gem "factory_girl_rails", ">= 3.1.0", :group => [:development, :test]
gem "email_spec", ">= 1.2.1", :group => :test
gem "cucumber-rails", ">= 1.3.0", :group => :test
gem "capybara", ">= 1.1.2", :group => :test
gem "database_cleaner", ">= 0.7.2", :group => :test
gem "launchy", ">= 2.1.0", :group => :test
gem "devise", ">= 2.1.0.rc"
gem "cancan", ">= 1.6.7"
gem "rolify", ">= 3.1.0"
gem "bootstrap-sass", ">= 2.0.1"
gem "nokogiri"

and within features/support/env.rb

require 'cucumber/rails'
.
.
.
Capybara.default_selector = :css
.
.
.
ActionController::Base.allow_rescue = false
.
.
.
begin
  DatabaseCleaner.strategy = :transaction
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

thanks

Upvotes: 1

Views: 607

Answers (2)

user821816
user821816

Reputation: 27

I had the same problem on OSX.

In my .bash_profile I had:

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/mysql/lib:/usr/lib/

I removed the /usr/lib and everything works fine.

To debug this I started with:

  1. locate libiconv.dylib
  2. oTool -L {lib} - for each library from previous step.

The system version in /usr/lib is version 7.0 and this is the source of the error. I then realized that the system was falling back to an older version of the library...thus leading my to my environment variables.

If you get this problem check LD_LIBRARY_PATH and DYLD_LIBRARY _PATH first!

Upvotes: -2

Zedrian
Zedrian

Reputation: 909

Apparently the problem came with nokogiri. I uninstalled the nokogiri gem and then re-installed it and now seems to be working.

An important note and there is a lot of junk on the web: DO NOT TOUCH, unless you really know what you are doing, /opt/local/lib/libiconv.2.dylib file or it can create problems with the OSX applications.

Upvotes: 4

Related Questions