I'm attempting to install a mysql gem on my workstation with this command

gem install mysql-2.8.1.gem

output :

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

C:/Ruby187/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... yes
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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:

Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.8.1
 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/ge

so it previously had trouble finding "libmysqllib" untill i copied the file into the same directory as the gem I am manually installing.

I'm behind a proxy, so I have to download the *.gem files and install from there.

Running XP Sp3
MySQL version : 5.1.53
Ruby Version 1.8.7

Gem list :

actionmailer (2.3.5, 2.3.4)
actionpack (2.3.5, 2.3.4)
activerecord (2.3.5, 2.3.4)
activeresource (2.3.5, 2.3.4)
activesupport (2.3.5, 2.3.4)
hoe (2.7.0)
json_pure (1.4.6)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
rake-compiler (0.7.5)
rubyforge (2.0.4)

Please help.

Kind Regards, Noel.


You're missing some compile-time dependencies. Things to check

  • Do you have the mysql dev files installed e.g. on Ubuntu this is libmysqlclient15-dev

  • Are the ruby1.8.7 dev files installed e.g. ruby1.8-dev Ubuntu

You really shouldn't need to copy the the lib. That would indicate that you probably don't have the mysqlclient libs installed

Hope that helps!


  • Already downloaded and installed from mysql.com "mysql-connector-c-6.0.2-win32.msi", which is the link for "MySQL Connectors/C (libmysql)" I think your right about missing that lib, but I have the file on my pc, hence why i copied it. Could not find the ruby dev files you mentioned, I'm on windows xp so I used 'ruby installer' to install ruby on my windows box "ruby-lang.org/en/downloads". – Ninja Noel Dec 16 '10 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.