Mysql gem troubles with Snow Leopard upgrade - mysql

I have done everything that is on the web (i think)
i have the new 64 bit xcode that came with snow leopard installed
completely removed mysql, removed gems compeltely, removed rails
installed mysql 64 bit, installed gems, installed mysql gem with the env ARCHFLAGS set
I still get this nasty
NameError: uninitialized constant MysqlCompat::MysqlRes
from /Users/Navara/Sites/tuosystems/vendor/rails/activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant'
from /Users/Navara/Sites/tuosystems/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `rake_original_const_missing'
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
Im not sure how to debug this..
any pointers will be greatly appreciated!

the only thing that i did not reinstall was the problem! RUBY! and doing that fixed it!

Related

Installing mysql2 gem with ruby 1.8.7 Mac OSX 10.6

I am currently trying to install the mysql2 gem, under Ruby 1.8.7 and Mac 10.6.6 and mysql 64 bits, so I can use Rails 3 and mysql together.
When I do the command:
sudo gem install mysql2
I get:
Building native extensions. This could take a while...
Successfully installed mysql2-0.2.6
1 gem installed
Installing ri documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
Enclosing class/module 'mMysql2' for class Result not known
Installing RDoc documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
Enclosing class/module 'mMysql2' for class Result not known
I did a lot of things recommended for this problem here on SO, but nothing seemed to help.
Has anyone got a idea about what to do next?
Edit: When I try do to rake db:migrate, it says: http://pastebin.com/tuPwQmqL. I can't do rails server either.
Edit 2: Managed to do it, thanks!
This is just a warning that the documentation for a module is empty. It shouldn't cause any problems.
If you are able to your commands like "rake db:migrate" etc. Everything is fine :)
Update: http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/. This link should solve your problem. I faced the same problem on my other mac :)
If you're using Rails 3, you should definitely be using Bundler and not doing sudo gem install anything. Add mysql2 to your Gemfile and just run bundle. That should install without any errors and let you run rake commands.

MySQL, RoR issues on Snow Leopard

I feel I've gone through every post on this subject, and I'm still banging my head against the wall.
I am running...
Mac OS 10.6.6
MySQL 5.1.4.4 (on MAMP) or (MySQL 5.5.8 in my /usr/ directory) both can be running and work fine
Ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0] (using RVM)
Rails 2.2.2
Gem 1.4.2
MySQL gem 2.8.1 (it says it's installed)
When I fire up the RoR app I've been developing, the mongrel appears to load fine. When I try to bring up the app in my browser I get the following error...
/!\ FAILSAFE /!\ Thu Jan 20 19:46:07 -0500 2011
Status: 500 Internal Server Error
uninitialized constant MysqlCompat::MysqlRes
then what follows are a bunch of lines like...
/Users/PJ/.rvm/gems/ruby-1.8.7-p330/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant'
I feel I have tired every variation of the ARCHFLAGS solutions that have been previously suggested on other posts. None have worked.
I am using MAMP and RVM as I have done other uninstalls and re-installs of MySQL, Ruby, Rails and various gems in attempts from other suggested solutions.
The app worked fine prior to my update to Snow Leopard. I am not a very sophisticated developer type, so I apologize in advance for being, well, not the brightest.
Try this AFTER making sure that Xcode is installed on your system.
gem uninstall mysql
export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --
no-ri mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/
local/mysql/bin/mysql_config
I coudn't ever seem to get the 2.8.1 mysql gem to work.
I downgraded it to the 2.7 version which led to a series of new errors (a DYLD_LIBRARY_PATH error), but it was eventually figured out and I am up and running again.

Mysql2 gem problem after upgrading to Snow Leopard

I upgraded to Snow Leopard recently and after having troubles with MySQL I upgraded it as well. I followed these instructions and built MySQL by myself using these sources.
Now MySQL server works fine, but I can't get Mysql2 gem working.
I keep getting this error when starting any Rails3 app:
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): no suitable image found. Did find: (LoadError)
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: mach-o, but wrong architecture - /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
I tried everything, but I'm still getting the same error. Do you have any idea what might be wrong?
Try installing MySQL 64 bit from here
I had the same problem and it worked for me ,
also try using rvm
some version of ruby might not work properly so it's pretty easy to change between them with rvm .

Setting up Mysql for Ruby on Rails in Windows

I'm on Windows, and I have a working Rails 2.3.8 app on Ruby 1.8.6 with MySQL 5.0 and the mysql gem version 2.8.1. It all works.
I just installed Ruby 1.9.1, installed gems for rails(2.3.8) and mysql. BUT NOW when I run ruby script/server:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
I ALREADY INSTALLED IT!
One thing that might be a problem:
When I run "gem list" in my working ruby (v1.8.6) install, it lists "mysql (2.8.1)". BUT when I run "gem list" in the new ruby install (v1.9.1), it lists "mysql (2.8.1 x86-mingw32)". If that's the cause, how do I fix it? If it's not, what on earth is keeping Rails from recognizing the installed mysql gem?
Thanks in advance. I'm sure this is a common upgrade path, so I can't be the only one with this problem...
Finally got some solid info.
Apparently the mysql gem sucks, and shouldn't be relied on going forward.
That's why Rails 3.0.0 officially endorses the mysql2 gem instead (gem install mysql2), which unfortunately is not supported under Windows yet, though the gem's developer seems to be working on it.
As I try to get my app to Rails 3, I'm just going to make the easy switch to sqlite3 until there's a good mysql gem for windows.

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?