Mac OS X Snow Leopard 上的 Rails:mysql2.bundle dlsym - 未找到符号(LoadError)

发布于 2024-11-09 06:29:52 字数 2517 浏览 0 评论 0原文

  • 平台:Mac OS X (macosx) 10.6.6
  • Ruby:1.9.2
  • Rails:3.0.3
  • 使用 RVM

这是我收到的错误:

$ rails s
/Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlsym(0x13782a0, Init_mysql2): symbol not found - /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle (LoadError)
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
from /Users/nicolas/git/hits/config/application.rb:7
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

这是一个非常持久的错误。以下是一些可能有助于解决此问题的更多信息:

  • 我过去曾从 Leopard 升级到 Snow Leopard。
  • 我尝试过捆绑安装。
  • 我尝试删除 ~/.rvm 并重新安装 RVM
  • 我尝试过: env ARCHFLAGS="-arch x86_64" gem install mysql2 -v 0.2.7
  • 我尝试安装最新的 mysql (mysql-5.5.12-osx10.6- x86_64.dmg)在任何之上 mysql 之前就存在于我的系统上

以下是有关我的系统的更多信息:

$ echo $DYLD_LIBRARY_PATH
/usr/local/mysql/lib:

$ file ~/.rvm/rubies/default/bin/ruby 
/Users/nicolas/.rvm/rubies/default/bin/ruby: Mach-O 64-bit executable x86_64

$ file /usr/local/mysql/lib/libmysqlclient.18.dylib
/usr/local/mysql/lib/libmysqlclient.18.dylib: Mach-O 64-bit dynamically linked shared library x86_64

$ rvm list
rvm rubies
=> ruby-1.9.2-p180 [ x86_64 ]

$ which ruby
/opt/local/bin/ruby

$ file /opt/local/bin/ruby
/opt/local/bin/ruby: Mach-O executable i386
  • Platform: Mac OS X (macosx) 10.6.6
  • Ruby: 1.9.2
  • Rails: 3.0.3
  • Using RVM

This is the error I am getting:

$ rails s
/Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlsym(0x13782a0, Init_mysql2): symbol not found - /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle (LoadError)
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
from /Users/nicolas/git/hits/config/application.rb:7
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

This a very persistent error. Here is some more info, that may help resolve it:

  • I have upgraded from Leopard to Snow Leopard in the past.
  • I have tried bundle install.
  • I have tried erasing ~/.rvm and re-installing RVM
  • I have tried: env ARCHFLAGS="-arch x86_64" gem install mysql2 -v 0.2.7
  • I tried installing the latest mysql (mysql-5.5.12-osx10.6-x86_64.dmg) on top of whatever
    mysql was there on my system before

Here is some more info about my system:

$ echo $DYLD_LIBRARY_PATH
/usr/local/mysql/lib:

$ file ~/.rvm/rubies/default/bin/ruby 
/Users/nicolas/.rvm/rubies/default/bin/ruby: Mach-O 64-bit executable x86_64

$ file /usr/local/mysql/lib/libmysqlclient.18.dylib
/usr/local/mysql/lib/libmysqlclient.18.dylib: Mach-O 64-bit dynamically linked shared library x86_64

$ rvm list
rvm rubies
=> ruby-1.9.2-p180 [ x86_64 ]

$ which ruby
/opt/local/bin/ruby

$ file /opt/local/bin/ruby
/opt/local/bin/ruby: Mach-O executable i386

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉城凉梦凉人心 2024-11-16 06:29:52

which ruby​​ 表示您使用的不是 RVM 提供的 ruby​​。安装 RVM 和 ruby​​ 后,你必须告诉 RVM 使用它:

rvm use --default 1.9.2

如果你还没有在 RVM 上安装 ruby​​ 那么你必须在使用之前安装它:

rvm install 1.9.2

之后你可能需要再次安装 Rails,因为你当前的版本可能是随系统 ruby​​ 而不是 RVM 一起安装的。

which ruby says that you're using not the RVM supplied ruby. After installing RVM and a ruby, you have to tell RVM to use it:

rvm use --default 1.9.2

If you haven't installed ruby on RVM yet then you have to install it before using:

rvm install 1.9.2

After that you will probably need to install rails again, as your current version is probably installed with the system ruby and not RVM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文