Issue with installing the mysql gem: solved, how to install mysql gem without issue

When tried to install mysql gem I got following error
[root@localhost siwan]# sudo gem install mysql
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… no
checking for rb_thread_start_timer()… yes
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
–without-mysql-config

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

To find the mysql path on machine used following command
[root@localhost siwan]# which mysql
/usr/bin/mysql

I tried following command:
[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql

I Got the same error

[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… no
checking for rb_thread_start_timer()… yes
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
–without-mysql-config

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR: could not find gem — locally or in a repository
ERROR: could not find gem –with-mysql-dir=/usr/bin/mysql locally or in a repository

Then I checked the mysql-devel
[root@localhost siwan]# yum list mysql-devel
Loaded plugins: refresh-packagekit
Available Packages
mysql-devel.i586 5.1.37-1.fc11 updates

Then I Installed the mysql-devel
[root@localhost siwan]# yum install mysql-devel
Installed:
mysql-devel.i586 0:5.1.37-1.fc11
Complete!

Then I tried the mysql Gem installing…..I am able to install the mysql gem…
[root@localhost siwan]# gem install mysql
Building native extensions. This could take a while…
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1…
Installing RDoc documentation for mysql-2.8.1…
[root@localhost siwan]#

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “Issue with installing the mysql gem: solved, how to install mysql gem without issue”

Leave a Reply

Your email address will not be published.