【发布时间】:2011-08-12 00:51:08
【问题描述】:
我通过 macport 安装了 ruby 和 ruby gems,但是 gem 列表不包括 mysql2。那么如何在“/opt/local/bin/gem”中的 gem 列表中安装 mysql2 gem
另外,什么是 mysql2 gem?我有 mysql gem,只想使用 mysql,不太确定 mysql2 是什么意思。当我尝试在应用程序上启动 webrick 时,它给了我一个 mysql2 错误。
更新: 我运行了 sudo gem install mysql2 并得到以下信息:
构建原生扩展。这 可能需要一段时间... 成功 已安装 mysql2-0.2.7 已安装 1 个 gem 安装 ri 文档 mysql2-0.2.7...
封闭类/模块'mMysql2' 类客户端未知
封闭类/模块'mMysql2' 类结果未知 安装 RDoc mysql2-0.2.7 的文档...
封闭类/模块'mMysql2' 类客户端未知
封闭类/模块'mMysql2' 类结果未知
假设安装了 mysql2,即使当我尝试在我的应用中启动 webrick 时文档没有收到以下错误。
导轨服务器:
/opt/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/opt/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9):库未加载: libmysqlclient.18.dylib (LoadError)
参考自: /opt/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle 原因:找不到图片 - /opt/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle 从 /opt/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8 从 /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:inrequire' from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:inrequire' 来自 /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:ineach' from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:inrequire' 来自 /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:ineach' from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:inrequire' 来自 /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:inrequire' from /Users/summer/Sites/simple_cms/config/application.rb:7 from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:inrequire' 来自 /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28 从 /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:intap' from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27 from script/rails:6:inrequire' 来自脚本/rails:6
【问题讨论】:
-
您缺少 libmysqlclient-dev 标头尝试在 macports 中搜索该库。这就是我必须在我的 Ubuntu 上安装才能安装 gem。
标签: ruby-on-rails ruby ruby-on-rails-3 rubygems