Installing ruby mysql / activerecord-mysql-adapter gem on RHEL 6 x86_64

I couldn’t install activerecord-mysql-adapter. After some duckduckgo’ing, I found the solution. Error:

Error:

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

/usr/bin/ruby extconf.rb --with-mysql-config=/usr/lib64/mysql/mysql_config
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.

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/ruby
        --with-mysql-config


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.9.1 for inspection.

Solution:

Solution was:
1) $ sudo yum install ruby-devel mysql-devel ruby-devel gcc
2) sudo env ARCHFLAGS=”-arch x86_64″ gem install mysql — –with-mysql-config=/usr/lib64/mysql/mysql_config
3) sudo env ARCHFLAGS=”-arch x86_64″ gem install activerecord-mysql-adapter — –with-mysql-config=/usr/lib64/mysql/mysql_config

(Kernel 2.6.32-358.2.1.el6.x86_64 )

More reading here: mysql forums