I've been trying all night, and so far have been unable to compile the mysql gem for ruby on my Debian Testing 64Bit system.

I believe it is because I have the openssl v1.0.0 library installed.

Here is what I get when I try to install (using RVM 1.14.7, and Ruby 1.9.1p431):

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

        /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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:
/home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:774:in `block in have_func'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:670:in `block in checking_for'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels) in postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:250:in `open'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:276:in `block in postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:250:in `open'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
    from /home/jarrett/.rvm/rubies/ruby-1.9.1-p431/lib/ruby/1.9.1/mkmf.rb:773:in `have_func'
    from extconf.rb:45:in `<main>'

Gem files will remain installed in /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1 for inspection.
Results logged to /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

When I checked the mkmf.log file (located at /home/jarrett/.rvm/gems/ruby-1.9.1-p431/gems/mysql-2.9.1/ext/mysql_api/mkmf.log, it was empty).

What I've tried

1) Ensuring all required dev packages are installed (libssl-dev libopenssl-ruby build-essential gcc autoconf automake libmysql-ruby ruby-mysql libmysqld-dev ruby-dev libmysql++-dev libmysqlclient-dev)

2) I originally had a more recent RVM installed - I uninstalled it and reinstalled an earlier version of RVM. I did this (following these instructions: https://stackoverflow.com/questions/13366409/undefined-symbol-sslv2-method-when-trying-to-run-thin-webserver) in the hope that I could then run rvm pkg install openssl (which installed openssl 0.9.8 locally) and then install ruby with this: rvm install 1.9.1 --with-openssl-dir=/home/jarrett/.rvm/usr. My hope was that this would use the 0.9.8 version of openssl. No dice.

3) Tried exporting the local openssl 0.9.8 to the LD_LIBRARY_PATH with export LD_LIBRARY_PATH=/home/jarrett/.rvm/usr/lib, and then running the install again. No dice.

4) Installing ruby 1.9.2 and 1.9.3 via RVM and trying them. No dice.

5) Yelling at the computer profusely. No dice.

Anyone have any ideas/suggestions?

Maybe is there a chance the mysql gem will be updated to use openssl 1.0.0 soon?


mkmf is part of ruby-dev package.

You need to do

sudo apt-get install ruby1.9.1-dev

And then try to install gem mysql.

EDIT: Sorry missed that. You might also try to install "mysql-devel".

| improve this answer | |
  • thanks @Danila, but I already have ruby-dev installed (as well as ruby1.9.1-dev)... – Jarrett Apr 25 '13 at 14:32
  • thanks - I had mysql dev packages installed, but forgot to add them to the list :) – Jarrett Apr 25 '13 at 14:47

Couldn't figure this out, so I followed these instructions to get openssl 0.9.8 installed (https://stackoverflow.com/questions/13366409/undefined-symbol-sslv2-method-when-trying-to-run-thin-webserver and https://rvm.io/packages/openssl/), and then installed the mysql2 gem and used that instead.

| improve this answer | |
  • Yeah, that'd do it. Even though it is weird that openssl1.0.0 is not supported. Quite weird. – Danila Ladner Apr 25 '13 at 15:03

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.