April 15th, 2006
Although i have nice Ruby on Rails support at dreamhost, i have decided to install RoR to my local machine. IMHO a local RoR, combined with Radrails and WEBrick is the simplest and quickest solution, usually fully enough for development purposes.
To install Ruby on Rails, you just need to do 3 things:
- Install Ruby
- Install RubyGems, a package management system for Ruby
- Once you have RubyGems installed, it is a piece of cake to install new packages. In this concrete case:
gem install rails –include-dependencies
And you are on rails! This was easy, wasn’t it?
Well, yes, unless you happen to use Ubuntu .
Under Ubuntu, the MySQL-Ruby binding was outdated. No problem, just get the newest mysql-ruby gem:
gem install libmysql-ruby At this point the trouble begun. Instead of installing the mysql binding, i got every kind of nasty error messages, including:
ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. ruby extconf.rb install mysqlnchecking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no
WTH?! I have googled a day to find the problem, then also wrote to the RoR and Ruby mailing lists, but got no answer. As i came to know later, this happened because my problem had nothing to do with Ruby, Rails or MySQL. After several hours of trying every possibility, i have been checking the last one: Do i have gcc and make on my machine? Well, i did not! I have thought a decent linux distribution should have make, gcc et al - and i was wrong (considering that Ubuntu is a decent distro).
Ubuntu is a very nice distribution, for desktop usage. However, if you are planning to use it for development, compiling etc., double check whether you have basic development tools (apt-get install build-essential), gcc and whatever you may need for compiling/deploying your applications.
Or install Rubuntu…

April 27th, 2006 at 7:53 am
Make sure you have the header files (libmysqlclient…-dev), confirm where your mysql is installed, and then let mysql_config do the rest of the talking for you (it will provide the location of the rest of the necessary files in order to compile):
gem install mysql — –with-mysql-dir=/usr/bin –with-mysql-config=/usr/bin/mysql_config
July 11th, 2006 at 6:12 am
Eventually, my mod_fcgid and typo work fine and many problems to be resolved…
Yesterday I tended to install modfcgid on my apache2, instead of modfastcgi or modruby because of some insecure pipe problem with the laters. And To be pride and surprised, the author of modfcgid is Chinese people, but that doesn’t help me to…
July 11th, 2006 at 6:24 am
Hi, nice post ! I googled here.
Servel hours previously I have the same problem as yours. I have installed build-essential package yet, but the error still humbled me. I guestimate it’s not because of starved of build-essential package, but ruby1.8-dev instead. You could check out whether you installed ruby1.8-dev before installing build-essential package.
July 11th, 2006 at 6:25 am
Hi, nice post ! I googled here.
Several hours previously I have the same problem as yours. I have installed build-essential package yet, but the error still humbled me. I guestimate it’s not because of starved of build-essential package, but ruby1.8-dev instead. You could check out whether you installed ruby1.8-dev before installing build-essential package.
March 19th, 2007 at 11:12 am
I have the same problem as yours. I install build-essential package, gcc, make, g++, but the error still humbled me. And then i install libmysqclient15-dev. And problem was solved.
Really usefull post! Thx!
July 1st, 2007 at 9:52 am
The following commands should fix this issue:
sudo apt-get install libmysqlclient-dev
cd /var/lib/gems/1.8/gems/mysql-2.7
sudo ruby extconf.rb
sudo make
sudo make install