I have got an issue attempting to install the Ruby mysql jewel driver.

I lately upgraded to Snow Leopard and did the Hivelogic manual install of MySQL. All of this appears to operate fine when i can access mysql in the command line making changes towards the database.

My problem is when I are now using

rake db:migrate

I recieve:

rake aborted!

uninitialized constant MysqlCompat::MysqlRes

(See full trace by running task with --trace)

Now it seems that my mysql jewel is not working properly when i can access MySQL fine from Python while using Python driver (that we put together to). I therefore attempted to rebuild the jewel while using following command out of this site: http://techliberty.blogspot.com/, (incidentally I'm utilizing a recent Apple Mac laptop Professional):

  sudo env ARCHFLAGS="-arch x86_64" jewel install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

This compiles although I recieve No definition for that documentation:

  Building native extensions.  This may require sometime...

  Effectively installed mysql-2.8.1

  1 jewel installed

  Setting up ri documentation for mysql-2.8.1...

  No definition for next_result

  No definition for area_title

  ...

I am a little stumped as my mysql_config is situated within the correct place:

 /usr/local/mysql/bin/mysql_config

And That I have removed other cases of the mysql jewel, from my system.

Any suggestions could be greatly appreciated. Thank you.

PS I saw this previous publish http://stackoverflow.com/questions/1332207/uninitialized-constant-mysqlcompatmysqlres-using-mms2r-jewel however it does not appear relevant for my version.

Essentially the issue is the the dynamic library libmysqlclient can not be found. The above mentioned solutions works, but you have to re-apply them when you rebuild the jewel, or whenever you use a latest version of MySQL.

An alternate approach would be to add the MySQL directory that contains the library for your dynamic load path. Putting the next during my .bashrc file reduced the problem:

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

OK, I have finally solved this issue.

The main reason it was occurring was which i had two versions of Ruby installed.

  1. I'd put together and installed my very own version of Ruby following a HiveLogic recommendations, pre my installing of Snow Leopard.
  2. Then i upgraded to Snow Leopard (that has it's own version of Ruby)

Both of these versions conflicted and resulted in if ever I attempted to set up the the MySQL jewel using the correct ARCHFLAGS the machine thought I had been utilizing a different version of Ruby.

The fix was not so difficult:

  1. Take away the HiveLogic version of Ruby (http://pivotallabs.com/customers/chad/blog/articles/407-getting rid of-old-ruby-source-installation-after-a-leopard-upgrade)
  2. Recompile the MySQL jewel using the correct ARCHFLAGS:

    sudo env ARCHFLAGS="-arch x86_64" jewel install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

After I tried this everything labored fine. Hope it matches your needs to.

B

Well, I'm a newbie. After battling for some time and also, since no above labored for me personally, I believed the issue was because of my "mysql" as being a 64-bit installation while ruby was 32-bit. Seek advice from these instructions

file `which mysql`

file `which ruby`

Both should match Mach-O 64-bit executable x86_64 or Mach-O 64-bit executable i386. I installed a 32-bit mysql, reinstalled ruby from source and rails and everything has been working perfectly since. I'm on Leopard btw.