Battle against RoR: gem install mysql…

May 17, 2007 § 12 Comments

is simply broken. Broken as hell.

This is my development environment:

  • Mac OS X 10.4.9
  • MySQL 5.0 under /usr/local/mysql
  • gcc 4.0.1 or gcc 3.3
  • readline 5.2
  • ruby 1.8.5
  • rubygems 0.9.3
  • fcgi 2.4.0

Everything was installed properly except mysql binding.

1. This is the command I called to install that module:

sudo gem install mysql — –with-mysql-dir=/usr/local/mysql

2. Didn’t work. Next:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.7 (ruby)

3. Works. But “rake migrate” didn’t work. Next:

4. Changed gcc from 4.0 to 3.3:

sudo gcc_select 3.3

5. Then ran:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.7 (ruby)

6. Didn’t even compile. Tried MySQL 2.6 (ruby):

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.6 (ruby)

7. Didn’t even compile. Damn!

Google search revealed this. Damn! Why some configurations work for some people? What The Hell???

8. So, I changed gcc back 4.0:

sudo gcc_select 4.0

9. Uninstall gem mysql:

sudo gem uninstall mysql

Now, obviously, “rake migrate” works.

Conclusion: RoR 1, me? Big Fat 0.
————————————————————————————————-

References:

Advertisements

§ 12 Responses to Battle against RoR: gem install mysql…

  • bngu says:

    Argh, I feel your pain. I have been struggling with this same exact issue on FC6. for some reason, I can’t seem to even pass the – -with-mysql-dir or – -with-mysql-config option to “gem install mysql”. It just bombs and says invalid option.

  • bngu says:

    SUCCESS FINALLY!!!

    here’s the command that did the trick for FC6,
    sudo gem install mysql — –with-mysql-config=/usr/bin/mysql_config

    Notice the 2 sets of — in a row, if you don’t do that, it will complain with-mysql-config as invalid option. This wasted 3 days of my freaking time but now I can move on with my life.

  • didip says:

    @bngu:

    Yeah, I had that problem before making my post. But u are absolutely right, the stupid “double –” is just lame.

    Good luck with your RoR effort.

  • ajay says:

    after screwing with this for a while, here’s the magic command that will get this installed on a CentOS 5 machine:

    gem install mysql — –with-mysql-config=/usr/bin/mysql_config

  • ajay says:

    okay, there is some funky formatting going on here. those dashes are actually two dashes so don’t cut ‘n’ paste my line from above. That’s where I went wrong.

    gem install mysql [dash][dash] [dash][dash]with-mysql-con…

  • didip says:

    @Ajay:

    Yes, the CSS on my blog use ‘funky formatting’. It has bitten myself several times. =)

    Thanks for the pointer though.

  • ic3m0nst3r says:

    CENTOS 5 INSTALL:
    before installing the gem with the options… do:

    1. yum install mysql-devel
    2. gem install mysql [dash][dash] [dash][dash]with-mysql-include=/usr/include/mysql [dash][dash]with-mysql-lib=/usr/lib/mysql

    thanks

  • K&P says:

    @didip:

    thanks for writing about this, i had some headaches too on CentOS 5.2

    @ic3m0nst3r:

    thanks! your solution worked for me.

  • Satya says:

    http://www.thesatya.com/blog/2009/07/rails_and_sybase.html

    Well, I just struggled with a Sybase issue as detailed on my blog. At the end, I found that I need mysql libraries. So I gem-installed mysql. Got borkage. Googled, found this page. Went “grrr”. Then realised that I could apt-get install libdbd-mysql-ruby, which I did, and it worked.

    I even tried getting mysql-devel, like someone suggested. Didn’t work for me.

    Stupid gems.

  • Richard says:

    my god.. can’t believe it was the double dash causing all the problems. I did the cut and paste funky thing too, and had to resinstall with [dash][dash].

    Word about RVM (if you use it) don’t use sudo if you have specific gemsets for your projects!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Battle against RoR: gem install mysql… at RAPD.

meta

%d bloggers like this: