Ruby - 常量 DL 和 Fiddle 未定义

Che*_*kar 5 ruby rubygems ruby-on-rails

当我执行 rake db:create 显示错误 Constants DL and Fiddle is not Defined 时

我正在使用红宝石2.2.3。我认为我的 rjb 有问题

耙子中止!

常量 DL 和 Fiddle 未定义。/home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:in load' /home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:ininit'/home/nibo/.rvm/gems/ruby -2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:72:在block in <class:Railtie>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:36:in调用'/home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2。 10/lib/active_support/lazy_load_hooks.rb:36:execute_hook' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:45:in在 run_load_hooks' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:44 中的块中:在each' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:44:inrun_load_hooks'/home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/ block in <module:Finisher>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:30:inapplication/finisher.rb:62:在instance_exec'/home/nibo/.rvm /gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:30 run' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:55:in:在 run_initializers' /home/nibo/.rvm/gems/ruby-2.2.5/gems/ 中的块中Railties-4.2.10/lib/rails/initialized.rb:54:run_initializers' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:352:in初始化!' /home/nibo/rails_workplace/ekylibre/config/environment.rb:5:in <top (required)>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes.rb:81:inrequire'/home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes。 rb:81:在require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in需要'/home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependency.rb:274:在block in require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:inload_dependency'/home/nibo/。 rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:在require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:328:inrequire_environment 中!' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:457:in block in run_tasks_blocks' /home/nibo/rails_workplace/ekylibre/lib/tasks/db/tenanting.rake:19:in' /home/nibo/.rvm/gems/ruby- 中的块2.2.5/gems/rake-12.1.0/exe/rake:27:在<top (required)>' /home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:ineval'/home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:<main>' LoadError: cannot load such file -- dl /home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:in在加载'/home/nibo /.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:in init' /home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:72:in' /home/nibo/.rvm/gems/ruby-2.2 中的块。 5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:36:在call' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:36:inexecute_hook'/home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support /lazy_load_hooks.rb:45:block in run_load_hooks' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:44:in在每个'/home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:44:run_load_hooks' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application/finisher.rb:62:in在'/home中的块中/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initialized.rb:30 instance_exec' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:30:in:运行' /home/nibo/.rvm/gems/ruby-2.2.5 /gems/railties-4.2.10/lib/rails/initializable.rb:55 block in run_initializers' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:54:in:在 run_initializers' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/ application.rb:352:in initialize!' /home/nibo/rails_workplace/ekylibre/config/environment.rb:5:in' /home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes.rb:81:in require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes.rb:81:inrequire' /home/nibo/ .rvm/gems/ruby-2.2.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:inblock in require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/ activesupport-4.2.10/lib/active_support/dependency.rb:240:in load_dependency' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:inrequire' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb :328:require_environment!' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:457:in在run_tasks_blocks'/home/nibo/rails_workplace/ekylibre/lib/tasks/db/tenanting.rake中的块中:19:inblock in <top (required)>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/rake-12.1.0/exe/rake:27:in' /home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in eval' /home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in' 小提琴::DLError: /usr/local/java/9-internal/jre/lib/amd64/server/libjvm .so:无法打开共享对象文件:没有这样的文件或目录/home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:在load' /home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:62:ininit' /home/nibo/.rvm/gems/ruby-2.2.5/gems/rjb-loader-0.0.2/lib/rjb-loader.rb:72:in block in <class:Railtie>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:36:incall' /home/nibo/.rvm/ gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:36:在execute_hook' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:45:inrun_load_hooks' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport 中的块中-4.2.10/lib/active_support/lazy_load_hooks.rb:44:在each' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/lazy_load_hooks.rb:44:inrun_load_hooks' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application/finisher 中。 rb:62:在block in <module:Finisher>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:30:ininstance_exec'/home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/ run' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initializable.rb:55:inrails/initialized.rb:30:在run_initializers'/home/nibo中的块中/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/initialized.rb:54 run_initializers' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:352:in:初始化!' /home/nibo/rails_workplace/ekylibre/config/environment.rb:5:in <top (required)>' /home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes.rb:81:inrequire'/home/nibo/.rvm/gems/ruby-2.2.5/gems/skylight-1.3.1/lib/skylight/probes。 rb:81:在require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/polyglot-0.3.5/lib/polyglot.rb:65:in需要'/home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependency.rb:274:在block in require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:inload_dependency'/home/nibo/。 rvm/gems/ruby-2.2.5/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:在require' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:328:inrequire_environment 中!' /home/nibo/.rvm/gems/ruby-2.2.5/gems/railties-4.2.10/lib/rails/application.rb:457:in block in run_tasks_blocks' /home/nibo/rails_workplace/ekylibre/lib/tasks/db/tenanting.rake:19:in' /home/nibo/.rvm/gems/ruby- 中的块2.2.5/gems/rake-12.1.0/exe/rake:27:in <top (required)>' /home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:ineval'/home/nibo/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `'

ATG*_*ATG 0

我在更新 Java 时偶尔会遇到这个问题,原因似乎是 RJB 人员没有跟上新的 JDK 布局。特别是,RJB 依赖于寻找libjvm.so某个地方$JAVA_HOME/jre,但自 Java 9 发布以来情况并非如此。

我发现的唯一解决方法是创建一个符号链接来复制 Ruby 期望在 Java 主目录中找到的路径。

这在我的 Linux 机器上起作用了(当以 root 身份运行时):

cd $JAVA_HOME
mkdir -p jre/lib/amd64
ln -s $JAVA_HOME/lib/server/ jre/lib/amd64/server
Run Code Online (Sandbox Code Playgroud)