雪豹的 mysql gem
一开始我在使用 gem 时遇到了麻烦,但是当我安装了 64 位 MySQL 并使用 arch 标志重新安装 gem 时,它就可以工作了。
所以它在轨道上工作。我以前遇到的错误是
uninitialized constant MysqlCompat::MysqlRes
,但现在已经消失了:)
但是在 Xcode 中,当我运行 RubyCocoa 项目时,我仍然收到旧错误
uninitialized constant MysqlCompat::MysqlRes
有人知道为什么会这样吗?
是因为gdb是64位的吗?
为什么它可以在 Rails 中运行,但在 RubyCocoa 中却不能运行?
稍微调试一下就发现加载mysql_api.bundle失败
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle:
dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle, 9): no suitable image found.
Did find: (LoadError) /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: mach-o, but wrong architecture -
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
I had trouble with the gem at first but got it to work when I installed the 64-bit MySQL and reinsatlled the gem with arch flags.
So it work in rails. The error I used to get was
uninitialized constant MysqlCompat::MysqlRes
but that is now gone :)
However in Xcode when I run a RubyCocoa project I still get the old error of
uninitialized constant MysqlCompat::MysqlRes
Does anyone know why this may be?
Is it because the gdb is 64-bit?
How can it work in Rails but not in RubyCocoa?
A little debugging shows that it fails to load mysql_api.bundle
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle:
dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle, 9): no suitable image found.
Did find: (LoadError) /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: mach-o, but wrong architecture -
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题可能是 xcode 使用了与您通常使用的不同版本的 ruby 框架,我遇到了这个麻烦并以某种方式解决了它。
不过,架构不匹配可能是其他原因:
/System/Library/Frameworks/Ruby.framework
The problem might be that xcode uses another version of the ruby framework than you are using normally, I had that trouble and solved it somehow.
The architecture mismatch might be some other thing though:
/System/Library/Frameworks/Ruby.framework
我遇到了同样的问题,如果我没记错的话,它与旧的 MySQL 安装有关。我一不小心安装了32位版本,注意到错误并安装了64位版本。
我通过删除 MySQL 消除了错误,如下所述:如何您是否从 Mac OS X 卸载 MySQL 并使用 arch 标志重新安装最新版本。
你尝试过这个吗?
I had the same problem and it had something to do with an older MySQL installation if I remember correctly. I installed the 32-bit version by accident, noticed the mistake and installed the 64-bit one.
I got rid of the error by removing MySQL as described here: How do you uninstall MySQL from Mac OS X and reinstalling the latest version with arch flags.
Did you try this?