Cannot install on ruby 2.0.0p0 (2013-02-24) [i386-mingw32] #359

Closed
DHB opened this Issue Mar 1, 2013 · 18 comments

Comments

Projects
None yet
10 participants

DHB commented Mar 1, 2013

$ gem install mysql2 -- '--with-mysql-lib="h:\database\MySQL\MySQL%20Server%205.5\lib" --with-mysql-include="h:\database\MySQL\MySQL%20Serv
er%205.5\include"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="h:\database\MySQL\MySQL%20Server%205.5\lib" --with-mysql-include="h:\database\MySQL\MySQ
L%20Server%205.5\include"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

gcc (rubenvb-4.7.2-release) 4.7.2

Gists containing gem_make.out and mkmf.log is here: https://gist.github.com/DHB/5067144

Confusing enough, “bundle install” seemingly installed the gem - without yielding any errors.
However, Rake afterwards barked:

$ rake -T --trace
rake aborted!
cannot load such file -- mysql2/2.0/mysql2
h:/Ruby200_p0/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require'
h:/Ruby200_p0/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
h:/Ruby200_p0/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
h:/Ruby200_p0/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'

mysql2.rb contains:

RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2"

but $1 directory 2.0 does not exist.

mperice commented Mar 4, 2013

Same here.

Collaborator

sodabrew commented Mar 4, 2013

Ugh, because they made it 2.0.0. Thanks for the heads up. Code welcome, or I'll get to it in a couple days.

Collaborator

sodabrew commented Mar 5, 2013

I notice that you're on Windows. I had no problem just now with Ruby 2.0.0 on OS X. @mperice are you also on Windows? Aha, got it. Not sure why we're emitting this piece of code.

casoetan commented Mar 5, 2013

is it fixed now for windows?

Collaborator

sodabrew commented Mar 5, 2013

No, no changes have been made. I'm still investigating.

odiszapc commented Apr 6, 2013

Hi, guys. Is it fixed now for Win platform?

odiszapc commented Apr 6, 2013

Had the same issue on Windows 7 x64 with Ruby 2.0.0 and DevKit 4.7.

The following steps help me.

  1. gem uninstall mysql2
  2. Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip
  3. Extract it to C:\connector-6.0.2
  4. gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\connector-6.0.2"'

If after installing the gem, you get an error:
"The specified module could not be found.
C:/Devel/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/lib/mysql2/mysql2.so"

That can be fixed by copying "libmysql.dll" to Ruby's bin folder.

Cheers.

Collaborator

sodabrew commented Jul 25, 2013

This should have been fixed by #386 and #393. Try mysql2 0.3.13.

@sodabrew sodabrew closed this Jul 25, 2013

I'm having a similar problem installing mysql2 0.3.14, as below. Can you make any suggestions for fixing this issue? I'm running Window 7 64 bit:

$ gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\MySQL-Connector-C-6.1\lib" --with-mysql-include="C:\MySQL-Connector-C-6.1
\include" --with-mysql-dir="C:\MySQL-Connector-C-6.1"'
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-lib="C:\MySQL-Connector-C-6.1\lib" --with-mysql-include="C:\MyS

QL-Connector-C-6.1\include" --with-mysql-dir="C:\MySQL-Connector-C-6.1"
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

Cannot find include dir at C:\MySQL-Connector-C-6.1\include;C:\MySQL-Connector-C-6.1\include;C:\MySQL-Connector-C-6.1/include

*** 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:/RailsInstaller/Ruby1.9.3/bin/ruby
--with-mysql-dir
--with-mysql-include=${mysql-dir}/include
--with-mysql-lib=${mysql-dir}/lib

Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/mysql2/gem_make.out

Robert B. Miller@LIONGATE1 ~/My Webs/Aptana Studio 3 Workspace/My First Rails Project

Hi I was able to install gem on Win7 but I get to see error while starting server.

C:\Ror> gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\incl
e"'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.14
1 gem installed
Installing ri documentation for mysql2-0.3.14...
DL is deprecated, please use Fiddle
Installing RDoc documentation for mysql2-0.3.14...

C:\Ror>rails s
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in require': cannot load such file -- mysql2/mysql2 (LoadError) from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in require' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inblock (2 levels) in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in each' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in each' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:inrequire'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in require' from C:/Ror/AutoSTATS/config/application.rb:7:in<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:in require' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:inblock in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in tap' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

C:\Ror>

Please let me know your suggestions on this.

Thanks,
Prasanth.RJ

Did you run bundle after intalling the gem?

On Wed, Dec 11, 2013 at 11:11 AM, prasanthrj notifications@github.comwrote:

Hi I was able to install gem on Win7 but I get to see error while starting
server.

C:\Ror> gem install mysql2 -- '--with-mysql-lib="c:\Program
Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program
Files\MySQL\MySQL Server 5.5\incl
e"'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.14
1 gem installed
Installing ri documentation for mysql2-0.3.14...
DL is deprecated, please use Fiddle
Installing RDoc documentation for mysql2-0.3.14...

C:\Ror>rails s
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in require':
cannot load such file -- mysql2/mysql2 (LoadError)
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inblock
(2 levels) in require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in
each'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock
in require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
each'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in
require'
from C:/Ror/AutoSTATS/config/application.rb:7:in'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:inblock
in '
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in
tap'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in
'
from script/rails:6:in require'
from script/rails:6:in'

C:\Ror>

Please let me know your suggestions on this.

Thanks,
Prasanth.RJ


Reply to this email directly or view it on GitHubhttps://github.com/brianmario/mysql2/issues/359#issuecomment-30345364
.


Robert B. Miller
LionGate Arms & Armour, Inc.
www.antiqueswords.com
tel. +1 (480) 948-6348
fax +1 (480) 315-9139
email: hussar@antiqueswords.com


@liongate Yes I did bundle and I dont see any errors while bundling the app. It throws error while starting rails server.

Are you running this as su? After installing the gem, did you run bundle
update?

On Wed, Dec 11, 2013 at 11:11 AM, prasanthrj notifications@github.comwrote:

Hi I was able to install gem on Win7 but I get to see error while starting
server.

C:\Ror> gem install mysql2 -- '--with-mysql-lib="c:\Program
Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program
Files\MySQL\MySQL Server 5.5\incl
e"'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.14
1 gem installed
Installing ri documentation for mysql2-0.3.14...
DL is deprecated, please use Fiddle
Installing RDoc documentation for mysql2-0.3.14...

C:\Ror>rails s
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in require':
cannot load such file -- mysql2/mysql2 (LoadError)
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inblock
(2 levels) in require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in
each'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock
in require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
each'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in
require'
from C:/Ror/AutoSTATS/config/application.rb:7:in'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:in
require'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:53:inblock
in '
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in
tap'
from
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:50:in
'
from script/rails:6:in require'
from script/rails:6:in'

C:\Ror>

Please let me know your suggestions on this.

Thanks,
Prasanth.RJ


Reply to this email directly or view it on GitHubhttps://github.com/brianmario/mysql2/issues/359#issuecomment-30345364
.


Robert B. Miller
LionGate Arms & Armour, Inc.
www.antiqueswords.com
tel. +1 (480) 948-6348
fax +1 (480) 315-9139
email: hussar@antiqueswords.com


I installed successfully just use: gem install mysql2 --platform=ruby -- '--with-mysql-lib="#{path_to_MySQL-Connector}\lib" --with-mysql-include="#{path_to_MySQL-Connector}\include"
Hope it helps.

What about if i m getting the same error on Ubuntu?

Collaborator

sodabrew commented Dec 26, 2014

@shilpi230 Which error? The original post was about Windows; the problems tend to be very different between Windows and Linux. The text ERROR: Failed to build gem native extension. doesn't indicate the specific problem, it's a generic error. You have to dig into the gem_make.out and mkmf.log files to see what happened.

Collaborator

sodabrew commented Feb 17, 2015

I released mysql2 version 0.3.18 with windows binaries today!

If you find a problem with the 0.3.18 version, please open a new ticket.

I am locking this issue now.

@sodabrew sodabrew locked and limited conversation to collaborators Feb 17, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.