我想用Ruby来玩更多,目前似乎掌握了sinatra,但现在也想从关系数据库中获取数据。我倾向于将Mysql用于测试应用程序,并尝试安装这些gem,但是当它试图编译它所依赖的原生do_mysql gem时,我一直收到异常。Datamapper的dm_mysql_adapter gem是否支持Windows?
我确实已经安装了本机扩展,并且它们对于JSON gem来说工作得很好,我记得之前在某个地方读到了do_mysql目前不支持Windows,所以只是想知道这是否仍然如此。
C:\dump\ruby\DataMapperTest\gems>gem install dm-mysql-adapter-1.2.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing dm-mysql-adapter-1.2.0.gem:
ERROR: Failed to build gem native extension.
C:/Tools/Ruby192/bin/ruby.exe extconf.rb
checking for my_global.h... no
checking for mysql.h... no
checking for main() in -llibmysql... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for localtime_r()... no
checking for gmtime_r()... no
checking for mysql.h... no
checking for MYSQL_TYPE_STRING in mysql.h... no
checking for MYSQL_TYPE_BIT in mysql.h... no
checking for MYSQL_TYPE_NEWDECIMAL in mysql.h... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for mysql_sqlstate() in mysql.h... no
checking for mysql_get_ssl_cipher() in mysql.h... no
checking for mysql_set_character_set() in mysql.h... no
checking for mysql_get_server_version() in mysql.h... no
checking for MYSQL_FIELD.charsetnr in mysql.h... no
creating Makefile
make
C:/Tools/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_do_mysql'" > do_mysql-i386-
mingw32.def
gcc -I. -IC:/Tools/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Tools/Ruby192/in
clude/ruby-1.9.1/ruby/backward -I/C/Tools/Ruby192/include/ruby-1.9.1 -I. -O3 -
g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings
-Wno-missing-field-initializers -Wno-long-long -Wall -o do_common.o -c do_com
mon.c
gcc -I. -IC:/Tools/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Tools/Ruby192/in
clude/ruby-1.9.1/ruby/backward -I/C/Tools/Ruby192/include/ruby-1.9.1 -I. -O3 -
g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings
-Wno-missing-field-initializers -Wno-long-long -Wall -o do_mysql.o -c do_mysq
l.c
do_mysql.c:5:19: fatal error: mysql.h: No such file or directory
compilation terminated.
make: *** [do_mysql.o] Error 1
Gem files will remain installed in C:/Tools/Ruby192/lib/ruby/gems/1.9.1/gems/do_
mysql-0.10.7 for inspection.
Results logged to C:/Tools/Ruby192/lib/ruby/gems/1.9.1/gems/do_mysql-0.10.7/ext/
do_mysql/gem_make.out
C:\dump\ruby\DataMapperTest\gems>
Mysql的5.5社区版安装并配置和MySQL的:
在Windows 7上使用Ruby 1.9.2
这里是例外柜面它有助于(通过安装红宝石+原生扩展安装)已被添加到系统PATH。
工作过,我学到了新东西。非常感谢您花时间帮忙!有一件事引起了我的兴趣,当时我正在命令行中指定MySQL目录,我试图使用相对路径,并导致错误,使其绝对修复它(我知道你展示的例子是绝对的,但没有知道这是一个要求),只是将其他人赶走。 – Grofit
太棒了,会更新说明提及,也避免与空间路径! :) –