This help site has been deprecated. Please send your requests to support@rubygems.org
cannot install mysql2 gem
Hi. I'm trying to install mysql2 gem on my windows 7 computer.
But when i do gem install mysql2 '0.3.14', i got an error, and i
can't understand what is happening. Can someone help me please? I'm
tryint to finish my "Redmine" install like forever, but it seems
that it is impossible.
PS: i installed another version of mysql2 gem, and it worked just
fine. but i'm using bundler to install all gems required to my
"Redmine" installation, and it requires to install the latest
version.
ERROR:
c:\webserver\Redmine>gem install mysql2 -v '0.3.14'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/webserver/Ruby/bin/ruby.exe extconf.rb
checking for ruby/thread.h... no
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_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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=C:/webserver/Ruby/bin/ruby --with-mysql-dir
--without-mysql-dir --with-mysql-include
--without-mysql-include=${mysql-dir}/include --with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib --with-mysql-config
--without-mysql-config --with-mysql-dir --without-mysql-dir
--with-mysql-include --without-mysql-include=${mysql-dir}/include
--with-mysql-lib --without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib --without-mysqlclientlib --with-mlib
--without-mlib --with-mysqlclientlib --without-mysqlclientlib
--with-zlib --without-zlib --with-mysqlclientlib
--without-mysqlclientlib --with-socketlib --without-socketlib
--with-mysqlclientlib --without-mysqlclientlib --with-nsllib
--without-nsllib --with-mysqlclientlib --without-mysqlclientlib
--with-mygcclib --without-mygcclib --with-mysqlclientlib
--without-mysqlclientlib
Gem files will remain installed in
C:/webserver/Ruby/lib/ruby/gems/1.9.1/gems/my
sql2-0.3.14 for inspection.
Results logged to
C:/webserver/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/m
ysql2/gem_make.out
Discussions are closed to public comments.
If you need help with RubyGems.org please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Luis Lavena on 29 Nov, 2013 04:56 PM
You need mysql headers and libraries to properly compile the gem.
Please see the following post about compilation of mysql (or mysql2) gems:
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
Sorry for top posting. Sent from mobile.
2 Posted by RG on 26 Jul, 2014 09:18 PM
I managed to succeed at this out of pure luck, but after an hour of hell I feel like I should share my solution, obviously very shortened but a lot of the steps I think you can figure out how to do on your own.
My machine is Win 7 64bit. I was able to install version 0.3.16
1. Install ruby version 2.0.0p481 (?)
2. Devkit blah blah
3. Install rails version 4.0.0
4. Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
5. Take DLL from that bin, put it in lib of ruby
6. gem install mysql2 -- -- with-mysql-dir="C:\mysqlc"
3 Posted by Luis Lavena on 28 Jul, 2014 11:12 PM
Hello,
There are known issues with x64 version of MySQL Connector/C and GCC
compiler (RubyInstaller is built with GCC).
https://bugs.ruby-lang.org/issues/8591
4 Posted by Dmitry on 11 Sep, 2014 09:25 PM
The solution is here:
https://medium.com/@frontlineutils/installing-the-mysql2-rubyonrails-gem-on-windows-7-8-a028f44d87f3
5 Posted by Luis Lavena on 12 Sep, 2014 12:44 AM
Dmitry, the post do not mention that using bundled lib from connector
package will segfault, as mentioned in the ruby bug report.
Sorry for top posting. Sent from mobile.