我有一个在Ubuntu上创建的Rails应用程序。我想在Mac上运行它,但安装捆绑软件并运行 rails s 后,出现以下错误:
LoadError:加载错误:sqlite3 / sqlite3_native - java.lang.UnsatisfiedLinkError:加载填充库失败,错误: dlopen(/Users/home/.rvm/ rubies / jruby-1.7.4 / lib / native / Darwin / libjruby-cext.dylib, 10):图片未找到需要在org / jruby / RubyKernel.java:1054 (root )at /Users/home/.rvm/gems/jruby-1.7.4/gems/sqlite3-1.3.8/lib/sqlite3.rb:6 需要在org / jruby / RubyKernel.java :1054美元(根) /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:1 在org / jruby / RubyArray.java:1617需要在/Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72 每个都在org / jruby / RubyArray.java:1617需要在/Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70 req uire at /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59 要求在 /Users/home/.rvm/gems/jruby-1.7.4@global/gems/bundler-1.3.5/lib/bundler.rb:132 需要在org / jruby / RubyKernel.java:1054( root)在 /Users/home/workSpace/RubyOnRails/sample_app/config/application.rb:13 在/ Users / home /下点击org / jruby / RubyKernel.java:1860(root)。 rvm / gems / jruby-1.7.4 / gems / railties-3.2.8 / lib / rails / commands.rb:1 在org / jruby / RubyKernel.java中需要:1054(root)在脚本/ 6
我的 Gemfile :
来源' rubygems '
gem'rails','3.2.8'
gem'sqlite3'
group:资产做宝石'sass-rails','〜> 3.2.3'宝石'咖啡栏','〜> 3.2.1'
宝石U glifier','> = 1.0.3'end
gem'jquery-rails'
gem'execjs '
group:test,:开发do gemrspec-rails,〜> 2.0end
gem'spork'
gem'webrat'
gem'heroku'
我在Java HotSpot(TM)64位服务器上使用 jruby 1.7.4(1.9.3p392)2013-05-16 2390d3b VM 1.7.0_15-b03 [darwin-x86_64] 和 Rails 3.2.8
解决方案这个问题源于您试图使用依赖于C扩展的Ruby gem的事实。来自 JRuby wiki :
1.6之前的JRuby版本不支持Ruby C扩展,即使在1.6版本中也支持,支持仍处于开发中并且被视为实验。
具体而言,错误消息指出: dlopen(/Users/home/.rvm/rubies/jruby-1.7.4/lib/native/Darwin/libjruby-cext.dylib,10):image not found 。这是试图加载未找到的JRuby C扩展包装。我不确定这里的确切原因,但可能它没有安装。
正如我看到的那样,您有两个主要选择:
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 'rubygems'
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
解决方案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:
JRuby versions prior to 1.6 did not support Ruby C extensions, and even in 1.6 the support is still "in development" and considered experimental. As of 1.7, it has been disabled and will likely be removed.
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:
更多推荐
Rails应用与JRuby无法正常工作
发布评论