I have an Rails app which was created on Ubuntu. I wanted to run it on a Mac, but after installing bundles and running rails s
, I get following errors:
LoadError: load error: sqlite3/sqlite3_native -- java.lang.UnsatisfiedLinkError: failed to load shim library, error: dlopen(/Users/home/.rvm/rubies/jruby-1.7.4/lib/native/Darwin/libjruby-cext.dylib, 10): image not found require at org/jruby/RubyKernel.java:1054
(root) at /Users/home/.rvm/gems/jruby-1.7.4/gems/sqlite3-1.3.8/lib/sqlite3.rb:6 require at org/jruby/RubyKernel.java:1054 (root) at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:1 each at org/jruby/RubyArray.java:1617 require at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72 each at org/jruby/RubyArray.java:1617 require at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70 require at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59 require at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler.rb:132 require at org/jruby/RubyKernel.java:1054 (root) at /Users/home/workSpace/RubyOnRails/sample_app/config/application.rb:13 tap at org/jruby/RubyKernel.java:1860 (root) at /Users/home/.rvm/gems/jruby-1.7.4/gems/railties-3.2.8/lib/rails/commands.rb:1 require at org/jruby/RubyKernel.java:1054 (root) at script/rails:6
My Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
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 'execjs'
group :test, :development do gem "rspec-rails", "~> 2.0" end
gem 'spork'
gem 'webrat'
gem 'heroku'
I am using jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_15-b03 [darwin-x86_64]
and Rails 3.2.8
JRuby 1.7.x no longer supports ruby C extensions. See this Jira ticket
The problem stems from the fact that you are trying to use a Ruby gem that relies on a C extension. From the JRuby wiki:
Specifically, the error message states:
dlopen(/Users/home/.rvm/rubies/jruby-1.7.4/lib/native/Darwin/libjruby-cext.dylib, 10): image not found
. This is attempting to load the JRuby C extension wrapper, which is not found. I'm not sure of the exact cause here, but perhaps it didn't get installed.As I see it, you have two main options: