[英]After upgrading Ruby1.9.2 from p180 to p290, libruby dynamic library path isn't updated
I used RVM to upgrade Ruby 1.9.2 from patch level p180 to p290: 我使用RVM将Ruby 1.9.2从补丁级别p180升级到p290:
rvm upgrade 1.9.2-p180 1.9.2-p290
Then, I used these commands to update my Rails gem and other gems 然后,我使用这些命令来更新我的Rails gem和其他gem
gem install rails 3.0.5
gem update
Everything seems to be fine; 一切似乎都很好; rvm info
shows all Ruby binaries and gems have been moved to the correct p290 path (~/.rvm/*/ruby-1.9.2-p290/*). rvm info
显示所有Ruby二进制文件和gem已被移动到正确的p290路径(〜/ .rvm / * / ruby-1.9.2-p290 / *)。
However, when I go to my Rails application directory and issue the command rails console
, I get the error message saying a gem (activesupport-3.0.5) cannot load the libruby.1.9.1.dylib
file. 但是,当我转到我的Rails应用程序目录并发出命令rails console
,我收到错误消息,指出gem(activesupport-3.0.5)无法加载libruby.1.9.1.dylib
文件。
10:30 AM ~/Development/rails_projects/my_app_0515 $ rails console 上午10:30〜/ Development / rails_projects / my_app_0515 $ rails console
/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle, 9): Library not loaded: /Users/whk/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (LoadError) Referenced from: /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle Reason: image not found - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle . /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in`requirement':dlopen(/Users/whk/.rvm /gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle,9): 未加载库:/Users/whk/.rvm/rubies/ruby-1.9.2-p180/ lib / libruby.1.9.1.dylib(LoadError)引用自:/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle原因:图片没有发现 - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle。 . 。 . 。
Rails can't find the dylib file in ~/.rvm/rubies/ruby-1.9.2-p180/lib
, because the p180
path no longer exists, but the file is in ~/.rvm/rubies/ruby-1.9.2-p290/lib
. Rails在~/.rvm/rubies/ruby-1.9.2-p180/lib
找不到dylib文件,因为p180
路径不再存在,但该文件位于~/.rvm/rubies/ruby-1.9.2-p290/lib
。
From a separate StackOverflow post , I found a workaround is adding this line to .bashrc 从单独的StackOverflow帖子中 ,我发现了一个解决方法是将此行添加到.bashrc
export DYLD_LIBRARY_PATH="/Users/whk/.rvm/rubies/ruby-1.9.2-p290/lib:$DYLD_LIBRARY_PATH"
However, I want to understand why the rvm ruby upgrade doesn't take care of the lib path change? 但是,我想了解为什么rvm ruby升级不会处理lib路径更改? Does anyone know a cleaner solution -- one that removes the p180 path from where it is configured? 有没有人知道更清洁的解决方案 - 从配置位置删除p180路径?
Here are my environment: 这是我的环境:
Thanks! 谢谢!
the problem was in gems native extension - their were nto rebuild during rvm upgrade 1.9.2-p180 1.9.2-p290
- next time please have closer look on the output ... it should give your information what's wrong. 问题出在gems原生扩展 - 他们在rvm upgrade 1.9.2-p180 1.9.2-p290
期间rvm upgrade 1.9.2-p180 1.9.2-p290
重建rvm upgrade 1.9.2-p180 1.9.2-p290
- 下次请仔细查看输出...它应该给你的信息有什么不对。
as for this particular use case it shoudl be enough to reinstall the given gem: 至于这个特殊的用例,它足以重新安装给定的gem:
gem install serialport -v 1.0.4
... not sure if it should be uninstalled first ...不确定是否应该先卸载它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.