1

I have been working on Ruby on Rails since 2 months go and now I want to change the database system so I installed the gem mysql2 by this command:

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-connector"'

And It works!

but the problem is when I want to run rails server again I got this error

c:\zreactor\demo>rails server
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `requir
e': 126: The specified module could not be found.   - C:/Ruby200-x64/lib/ruby/ge
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.16/mysql2/mysql2.so (LoadError)

        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2.rb
:8:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:76:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:76:in `block (2 levels) in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:72:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:72:in `block in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:61:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/r
untime.rb:61:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler.r
b:133:in `require'
        from c:/zreactor/demo/config/application.rb:7:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:74:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:74:in `block in <top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:71:in `tap'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:71:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

I searched in the source and it looks everything ok,I have no idea why I got this error.

I'm working on W8 with ruby 2.0 and rails 4.0.2.

I would appreciate your help guys, Thanks!

rfcabal
  • 121
  • 1
  • 4
  • 17
  • Welcome to SO! Nicely written question. Does the specified file (`C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.16/mysql2/mysql2.so`) actually exist? – Jared Beck Oct 12 '14 at 03:59
  • Thanks Jared. The file exists and I'm using the x64 mysql connector library. – rfcabal Oct 12 '14 at 15:21
  • 1
    Have you seen https://github.com/brianmario/mysql2/issues/359 it seems related, maybe? Sorry I can't help more. – Jared Beck Oct 13 '14 at 01:58
  • Thanks Jared, I found the right connector! I wasn´t copy the library file that was part of my problem too. Thank you! – rfcabal Oct 19 '14 at 23:50

1 Answers1

2

Most likely you need to regenerate libmysql.lib as described here:

...mysql2/mysql2.so: [BUG] Segmentation fault ruby 2.0.0p247

Community
  • 1
  • 1