HeatWare.net header image
HeatWare.net
TwitterRSSEmail
  • Home
  • Windows
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
  • Linux/Unix
  • Mac
  • Mobile
    • Android
    • iOS
    • Phones (Help / Resources)
  • Software / Programming
    • Free Software
    • Programming – General
    • PHP
    • Ruby/Rails
    • Quality Assurance (QA)
    • Software – General
    • Software Help
    • Databases
  • Cool Websites
  • Other
    • Deals & Bargains
    • News
    • Video Games
    • Hardware
    • Electronics
  • About

16 comments / June 14, 2011 / sood / Programming – Ruby/Rails

Solved! Installing mysql gem – extconf.rb failed error

Are you attempting to install the mysql gem and you are receiving this error?


Fetching: mysql-2.8.1.gem (100%)
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.

Well, we have the solution for you. Your Linux installation requires that the development libraries for MySQL to be installed in order to build the gem. Here is the proper way for install this gem:

How to install mysql gem

sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient-dev
sudo gem install mysql

If you are still having trouble….

Try installing the development package of Ruby 1.8 (or newer) by using the command below, and then attempt to install the MySQL gem:
sudo apt-get install ruby1.8-dev or sudo apt-get install ruby1.9.1-dev

Related Posts

  • Solved! Installing sqlite3-ruby gem - extconf.rb mkmf LoadError
  • Fetch error installing Java on Ubuntu 11.04. Solved!
  • How to install Ruby 1.8.7 on CentOS 5.5 Linux
  • How to install RubyGems on Linux (Ubuntu & Other)
  • How to install a FTP server on Linux in 30 seconds

gem Linux mysql ruby

16 comments… add one
  1. Richard November 13, 2011, 7:19 pm

    Thanks! I tried a heap of other solutions including install a dev package and this is the only one that worked.

  2. Justus November 28, 2011, 8:11 am

    Thanks a lot. Precisely my problem. Quick way to install the right libraries.

  3. Ivan April 19, 2012, 6:16 am

    Thank you very much!!!
    This very simple solution for my problem.

  4. Daniel August 23, 2012, 7:35 am

    Thanks. Simple and precise.

  5. regex December 12, 2012, 1:31 pm

    thank you 😀

  6. DoctorRu June 4, 2013, 10:12 am

    Thks a lot!

  7. kalvinmanson October 15, 2013, 5:00 pm

    How i can do this on Windows?

  8. leandro March 29, 2014, 12:16 pm

    Thanks a lot man.

  9. Michael Gaston June 13, 2014, 11:48 am

    Perfect!

  10. Pepette August 4, 2014, 11:45 am

    If like me, you have some coworker working on a rails project using Windows (in my case Windows 7).
    In order to install the gem “mysql2″ you need to specify in the command line the path to use the libraries.

    Pre-requisite: Having MYSQL installed.

    Command line to run (replace the path by your installation path)
    gem install mysql2 — ‘–with-mysql-lib=”c:\Program Files\MySQL\MySQL Server 5.6\lib” –with-mysql-include=”c:\Program Files\MySQL\MySQL Server 5.6\include”‘

  11. Dave August 7, 2014, 8:38 pm

    From *buntu 12.04 inclusive onwards, it has changed to
    sudo apt-get install ruby-mysql

    After 13.10, the libmysql-ruby above no longer exists, use ruby-mysql

  12. OneSeven October 6, 2014, 3:35 am

    How about Win 7?
    Tried with gem install mysql2 — ‘–with-mysql-lib=”c:\Program Files\MySQL\MySQL Server 5.6\lib” –with-mysql-include=”c:\Program Files\MySQL\MySQL Server 5.6\include”‘
    it works, but with connector solution, it failed, also met the 1% error

Cancel reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Why You Should Consider Diving Apps
  • How to Buy a Smartphone that Fits Your Budget
  • How to Overcome Frustrating PDF Stress
  • Convert PDF to Word: Easy, Reliable and Quality Conversion
  • PDF to Excel App ­ – A New Way of Handling Tricky Documents

Recent Comments

  • Valarie Walter on Basic Troubleshooting Steps for your Cell Phone
  • John Mists on A Brief History of Android OS
  • syarif on PostgreSQL: How to reload config settings without restarting database
  • Raghu on How to SSH to a server using Ruby – Part I
  • francisco clemente on Basic Troubleshooting Steps for your Cell Phone

Tags

ACSLS Android Cell Phones Cool Software Cool Websites Databases Facebook File System Free Software G2x Galaxy S5 Hot Deals iOS iPhone ISO LG Linux Linux/Unix Mac Mobile mysql OpenStack OS X PHP Postgres PostgreSQL Printers Programming ruby Samsung Galaxy S6 Shell Smartphones Sun T-Mobile Tips Tips & Tricks Ubuntu Unix Virtualization VMWare Windows Windows 7 Windows 8 Windows Vista Windows XP

Latest Tweet

Follow @HeatwaredotNet

SP
@HeatwaredotNet

  • Why You Should Consider Diving Apps https://t.co/Is41cdUv2I #diving-apps
    about 5 years ago

All Categories

Other Links

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2015 — HeatWare