tag:help.rubygems.org,2010-01-19:/discussions/questions/5857-cannot-install-mysql2-gemRubyGems.org: Discussion 2015-08-17T19:38:56Ztag:help.rubygems.org,2010-01-19:Comment/302670072013-11-29T15:53:44Z2013-11-29T15:53:45Zcannot install mysql2 gem<div><p>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.<br>
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.</p>
<h2><a href="#error-" class="anchor" name="error-" id=
"error-"></a>ERROR:</h2>
<p>c:\webserver\Redmine>gem install mysql2 -v '0.3.14'<br>
Temporarily enhancing PATH to include DevKit...<br>
Building native extensions. This could take a while...<br>
ERROR: Error installing mysql2:<br>
ERROR: Failed to build gem native extension.</p>
<pre>
<code> C:/webserver/Ruby/bin/ruby.exe extconf.rb</code>
</pre>
<p>checking for ruby/thread.h... no<br>
checking for rb_thread_blocking_region()... yes<br>
checking for rb_wait_for_single_fd()... yes<br>
checking for rb_hash_dup()... yes<br>
checking for rb_intern3()... yes<br>
checking for mysql_query() in -lmysqlclient... no<br>
checking for main() in -lm... yes<br>
checking for mysql_query() in -lmysqlclient... no<br>
checking for main() in -lz... no<br>
checking for mysql_query() in -lmysqlclient... no<br>
checking for main() in -lsocket... no<br>
checking for mysql_query() in -lmysqlclient... no<br>
checking for main() in -lnsl... no<br>
checking for mysql_query() in -lmysqlclient... no<br>
checking for main() in -lmygcc... no<br>
checking for mysql_query() in -lmysqlclient... no<br>
*** extconf.rb failed *** Could not create Makefile due to some
reason, probably lack of<br>
necessary libraries and/or headers. Check the mkmf.log file for
more<br>
details. You may need configuration options.</p>
<p>Provided configuration options:<br>
--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</p>
<p>Gem files will remain installed in
C:/webserver/Ruby/lib/ruby/gems/1.9.1/gems/my<br>
sql2-0.3.14 for inspection.<br>
Results logged to
C:/webserver/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/m<br>
ysql2/gem_make.out</p></div>Gabriel Ferreiratag:help.rubygems.org,2010-01-19:Comment/302670072013-11-29T16:56:31Z2013-11-29T16:56:31Zcannot install mysql2 gem<div><p>You need mysql headers and libraries to properly compile the
gem.</p>
<p>Please see the following post about compilation of mysql (or
mysql2) gems:</p>
<p><a href=
"http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/">
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-...</a></p>
<p>Sorry for top posting. Sent from mobile.</p></div>Luis Lavenatag:help.rubygems.org,2010-01-19:Comment/302670072014-07-26T21:18:19Z2014-07-26T21:18:21Zcannot install mysql2 gem<div><p>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.</p>
<p>My machine is Win 7 64bit. I was able to install version
0.3.16</p>
<ol>
<li>Install ruby version 2.0.0p481 (?)<br></li>
<li>Devkit blah blah<br></li>
<li>Install rails version 4.0.0<br></li>
<li>Download Mysql Connector C 64 bit zip file, put in C drive as
mysqlc<br></li>
<li>Take DLL from that bin, put it in lib of ruby<br></li>
<li>gem install mysql2 -- -- with-mysql-dir="C:\mysqlc"</li>
</ol></div>RGtag:help.rubygems.org,2010-01-19:Comment/302670072014-07-28T23:12:37Z2014-07-28T23:12:37Zcannot install mysql2 gem<div><p>Hello,</p>
<p>There are known issues with x64 version of MySQL Connector/C and
GCC<br>
compiler (RubyInstaller is built with GCC).</p>
<p><a href=
"https://bugs.ruby-lang.org/issues/8591">https://bugs.ruby-lang.org/issues/8591</a></p></div>Luis Lavenatag:help.rubygems.org,2010-01-19:Comment/302670072014-09-11T21:25:40Z2014-09-11T21:25:43Zcannot install mysql2 gem<div><p>The solution is here:</p>
<p><a href=
"https://medium.com/@frontlineutils/installing-the-mysql2-rubyonrails-gem-on-windows-7-8-a028f44d87f3">
https://medium.com/@frontlineutils/installing-the-mysql2-rubyonrail...</a></p></div>Dmitrytag:help.rubygems.org,2010-01-19:Comment/302670072014-09-12T00:44:11Z2014-09-12T00:44:11Zcannot install mysql2 gem<div><p>Dmitry, the post do not mention that using bundled lib from
connector<br>
package will segfault, as mentioned in the ruby bug report.</p>
<p>Sorry for top posting. Sent from mobile.</p></div>Luis Lavena