• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Our Blog

    Ongoing observations by End Point Dev people

    MySQL Ruby Gem CentOS RHEL 5 Installation Error Troubleshooting

    Adam Vollrath

    By Adam Vollrath
    February 9, 2010

    Building and installing the Ruby mysql gem on freshly-installed Red Hat based systems sometimes produces the frustratingly ambiguous error below:

    # gem install mysql
    /usr/bin/ruby extconf.rb
    checking for mysql_ssl_set()... no
    checking for rb_str_set_len()... no
    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.
    

    Searching the web for info on this error yields two basic solutions:

    1. Install the mysql-devel package (this provides the mysql.h file in /usr/include/mysql/).
    2. Run gem install mysql – –with-mysql-config=/usr/bin/mysql_config or some other additional options.

    These are correct but not sufficient. Because this gem compiles a library to interface with MySQL’s C API, the gcc and make packages are also required to create the build environment:

    # yum install mysql-devel gcc make
    # gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
    

    Alternatively, if you’re using your distro’s ruby (not a custom build like Ruby Enterprise Edition), you can install EPEL’s ruby-mysql package along with their rubygem-rails and other packages.

    database hosting mysql redhat rails


    Comments