views:

263

answers:

2

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'
A: 

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

sunkencity
A: 

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?

Cimm