I have nearly the same problem with the one discussed on the link below:
Error installing Mysql2 gem- 10.6 Server
I have followed the solution described but I get this:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection.
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
Additionally I also tried to specified all mysql path:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql --
--with-mysql-dir=/usr/local/mysql
--with-mysql-lib=/usr/local/mysql/lib
--with-mysql-include=/usr/local/mysql/include
--with-mysql-config=/usr/local/mysql/bin/mysql_config
And still get the error
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/Users/angelos/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7 for inspection.
Results logged to /Users/angelos/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
Any help apreciated.
Do you have the mysql header files actually installed in the paths you link to? Have you installed a package of mysql that includes the header file?
/usr/local/mysql
I have installed mysql with ports and I have it in /opt
$ find /opt -name mysql.h
/opt/local/include/mysql5/mysql/mysql.h
you could try
$ find /usr/local -name mysql.h
I backtracked to version 5.1.59 of mysql instead of 5.5 and it worked fine.
It seems the gem is still incompatible with MySQL 5.5.xx
Related
I'm trying to setup a not so old (but still few years) of Rails project on new Mavericks machine.
When I try to bundle, i keep getting this error (sorry for the long code):
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/royzinn/.rbenv/versions/1.8.7-p352/bin/ruby extconf.rb --with-mysql-config=/usr/local/Cellar/mysql/5.5.20/bin/mysql_config
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/Users/royzinn/.rbenv/versions/1.8.7-p352/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18 for inspection.
Results logged to /Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18/ext/mysql2/gem_make.out
Before that I had a message saying that the gem was built for MySQL version 5.5.20 and that I have already activated other (more advanced) MySQL.
I "cleaned" everything with Homebrew, tried to reinstall but nothing seems to work.
Any help is highly appreciated.
Thanks!
Try to delete this directory :
/Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18
If this doesn't help delete rvm directory and reinstall
First, make sure the gem can compile on installation.
gem install mysql
If you get an error that the gem won't compile, it may be necessary to install MySQL where Bundler can find it--even though it is included with OS X. Rather than passing paths as arguments to Bundler, just install MySQL with Homebrew and then install the gem.
brew install mysql
gem install mysql2
Finally, the mysql2 gem's version is probably out of date in the Gemfile and needs to be updated.
bundle update mysql2
I followed this post, http://blog.teamtreehouse.com/installing-ruby-rails-and-mysql-on-os-x-lion.
I have been learning Ruby and Rails for a month, so I am quite familiar with Ruby. I also know some parts of Rails due to the understandings acquired by following several tutorials.
However, I continuously fail to gem install mysql or gem install mysql2 prior to rails new photos -d mysql.
I already successfully finished brew install mysql and checked mysql -u root.
seodongju#Seoui-MacBook-Pro ~/Desktop/Projects$ sudo gem install mysql2
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql.h... no
checking for mysql/mysql.h... no
mysql.h is missing. please check your installation of mysql and try again.
*** 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 --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/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby --with-mysql-config --without-mysql-config
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.13 for inspection. Results logged to /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.13/ext/mysql2/gem_make.out
You should install MySQL on your machine first
Take it from here
http://dev.mysql.com/downloads/installer
After installing it install the Gem
I'm getting this error when I try to install the MySQL gem with Rails 3 on OSX 10.7 Lion.
My Ruby version is ruby 1.9.2p290. I have already installed MySQL and its working perfectly.
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/garethbarker/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
*** 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
--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=/Users/garethbarker/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /Users/garethbarker/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1 for inspection.
Results logged to /Users/garethbarker/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
I recall having a similar problem on my Lion OS. Try this out. I found it lying around in my ~/.bash_profile. Add to your ~/.bash_profile:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
or
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
I just got put in charge of a new app, one that is already built, to add new features and the like to it. Unfortunately, It was built several years ago (using rails 2.1) and uses mysql (I prefer postgres). I am attempting to install the mysql gem so I can mess about with the code on my local machine and I am getting the following error.
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/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
--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=/opt/local/bin/ruby
--with-mysql-config
Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
I checked the directory /usr/local/mysql/bin/mysql_config to make sure the file existed (it does)...I installed mysql with the dmg file (v 5.1) from the mysql site.
Frankly I'm at a loss as for how the hell to fix this. Any suggestions?
Thanks!
I don't think the mysql header files are included in the dmg-file. Install either Homebrew or Macports and run brew install mysql or sudo port -v install mysql5-server mysql5
I'm trying to install the mysql2 gem on 10.6 server and I get an error message I haven't seen:
EBuilding native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out
I've tried a couple things, specifying where the built-in MySQL is stored sudo gem install mysql2 -- --with-mysql-dir=/var/mysql and also replacing the built-in mysql with the pre-built 64-bit installer from mysql.com
Any ideas?
Figured it out:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I found out you have to have the package mysql-devel installed ... On Centos
do yum -y install mysql-devel and you're good to go.
I have the same problem on OSX 10.5 with RVM with the "system" Ruby interpreter. Using Ruby 1.8.7 through RVM fixed the situation.
I was inspired by: https://gist.github.com/440334#file_gistfile1.txt