Reputation: 2373
I'm trying to set up rails for the first time. I've got the app made, I've been following lots of guides.
When I try to install the mysql gem 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()... 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
--without-mysql-config
Looking around on SO and Google, people say to do:
gem install mysql --with-mysql-config=/usr/bin/mysql_config
but I get:
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-mysql-config=/usr/bin/mysql_config
Any ideas on how I can get this to work?
Upvotes: 1
Views: 1857
Reputation: 663
If you haven't already you'll need to install the MySQL development library as root:
yum install mysql-devel
Then in the gem install command you need to have another -- in the command line before the --with-mysql-config option:
gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Upvotes: 1