Error while installing the mysql gem

Hi All,

When i'm provide "gem install mysql" command, i got the following error.
Please support me in getting out this error.

Building native extensions. This could take a while...
ERROR: Error installing mysql:
  ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
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
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/usr/bin/ruby1.8
  --with-mysql-config
  --without-mysql-config
  --with-mysql-dir
  --without-mysql-dir
  --with-mysql-include
  --without-mysql-include=${mysql-dir}/include
  --with-mysql-lib
  --without-mysql-lib=${mysql-dir}/lib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-mlib
  --without-mlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-zlib
  --without-zlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-socketlib
  --without-socketlib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-nsllib
  --without-nsllib
  --with-mysqlclientlib
  --without-mysqlclientlib
  --with-mygcclib
  --without-mygcclib
  --with-mysqlclientlib
  --without-mysqlclientlib

Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1
for inspection.
Results logged to
/var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

Thanks,
Priya

Hi All,

When i'm provide "gem install mysql" command, i got the following error.
Please support me in getting out this error.

Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

You have not said which OS you are using. Also are you using Rails 2 or 3?

Colin

Sorry Colin.. I'm using Ubuntu 10.10 and rails 2.3.5

Colin Law wrote in post #967171:

Please don't top post, it makes it difficult to follow the thread.
Insert your reply into the previous post. Thanks.

Sorry Colin.. I'm using Ubuntu 10.10 and rails 2.3.5

In that case I believe you should be using sudo for installing gems,
unless you are also using rvm which I think you are not, so
sudo gem install mysql.

I don't think that will fix the problem though, but try it first.
Otherwise these are the packages I installed to get the rails
development environment going. This was on 10.04 so it may not be
spot on. You likely have most of them already.

sudo apt-get install build-essential

It might be worth trying again at this point, if the above installed
anything. Otherwise:

sudo apt-get install ruby ri rdoc libmysql-ruby ruby1.8-dev irb1.8
libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libnet-daemon-perl
libplrpc-perl libreadline-ruby1.8 libruby1.8 rdoc1.8 ri1.8 ruby1.8 irb
libopenssl-ruby libopenssl-ruby1.8 libhtml-template-perl

That is all one line, though obviously you can split it into multiple
sudo apt-get install commands if you want to. As I said that was for
10.04 rather than 10.10 so some of them may not be available I
suppose. It will do no harm though provided it does not say that it
is going to _remove_ anything. If it does say that then I would
advise against doing it.

Have you googled for install rails ubuntu 10.10? You might get a
better list there.

Alternatively you might like to consider installing under rvm, this
gives you the flexibility to easily move up to the latest rails when
you want to. If you are just starting I would recommend going with
rvm and rails 3 anyway. I can tell you exactly what I did to install
2.3.x and 3 under rvm.

Colin

I have installed a dependent library(libmysqlclient-dev), after that
mysql gem is installed successfully.