Error "... no puedo cargar dicho archivo - mysql2 / 2.0 / mysql2 (LoadError)". En Windows XP con Ruby 2.0.0
El comandorails server
arroja este error.
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load
such file -- mysql2/2.0/mysql2 (LoadError)
yo sueloRuby 2.0.0 desdeRubyInstalador en el cuadro de Windows XP.
Descubrí cuál es el problema pero no sé cómo resolverlo. El problema es que no hay ninguna2.0/
directorio en elmysql2-0.3.11-x86-mingw32
joya. Esta es la joya querails
Se instala como su dependencia desdeGemfile:
GEM
remote: https://rubygems.org/
specs:
... many gems here
mysql2 (0.3.11-x86-mingw32)
... many gems here
DEPENDENCIES
...
mysql2
...
Esto es lo que hay en eso.mysql2.rb
expediente:
# C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\mysql2.rb
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2" # <<-- this is that #2 line that throws an error
Es obvio que toma el número de versión actual de Ruby y lo usa como el segmento de ruta para llegar a algunosmysql2
expediente. De hecho esmysql2.so
expediente. Como yo usoRuby 2.0.0 el segmento de la ruta es2.0
:
mysql2/2.0/mysql2
Ok, ahora veamos como ese directorio demysql2-0.3.11-x86-mingw32
gema se ve como
dir: C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\
No ninguno2.0/
directorio.
Conozco el tema delibmysql.dll. Lo tengo en miC:\Ruby200\bin
. No ayuda
Leo esta respuestahttps://stackoverflow.com/a/5368767/1114926 Del creador de RubyInstaller. Lo intenté pero no sirvió de nada. Funciona paraRuby 1.9.3
porque hay1.9/
directorio. Pero no funciona paraRuby 2.0.0
.
¿Cómo resolverlo?
UPD 1:
Gracias por suresponder. He intentado. Lamentablemente tengoERROR: Failed to build gem native extension.
error:
C:\>gem install mysql2 --platform=ruby
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:/Ruby200/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... *** 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:/Ruby200/bin/ruby
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (Runtim
eError)
You have to install development tools first.
... other code follows here...
Dice:
Tienes que instalar primero las herramientas de desarrollo.
Pero tengo DevKit completo instalado, RubyInstaller lo instala. No puedo entender qué más necesita.
Ya he publicado un problema enmysql2
Página de GitHubhttps://github.com/brianmario/mysql2/issues/364. No hay respuestas todavía.