简体   繁体   中英

mysql gem for snow leopard

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'

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM