Datamapper'的dm_mysql_adapter gem在windows上是否支持?[英] Is Datamapper's dm_mysql_adapter gem supported on windows?

本文是小编为大家收集整理的关于Datamapper'的dm_mysql_adapter gem在windows上是否支持?的处理方法,想解了Datamapper'的dm_mysql_adapter gem在windows上是否支持?的问题怎么解决?Datamapper'的dm_mysql_adapter gem在windows上是否支持?问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我想与Ruby一起玩更多,目前似乎对Sinatra有所了解,但现在也想从关系数据库中获取数据.我倾向于将mySQL用于测试应用程序,并尝试安装宝石,但是当它试图编译本机依赖的本机do_mysql Gem时,我一直会得到例外.

.

我确实已经安装了本机扩展名,并且它们在JSON GEM上工作正常,我记得我不久前在某个地方阅读了do_mysql当前不支持Windows,所以只是想知道是否仍然如此.

>

在Windows 7上使用Ruby 1.9.2(通过Ruby Installer +本机扩展安装)

以下是例外,它会有所帮助:

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已添加到系统路径中.

推荐答案

datamapper和dataObjects(连接到DB的下层) do 在Windows上工作.

然而,似乎do_mysql 0.10.7缺少x86-mingw32平台的预编译二进制文件:

http://rubygems.org/gems/do_mysql/versions

您可以使用MySQL连接器/C接口来编译DO_MYSQL,该界面与您在计算机中安装的MySQL的版本无关.

请看一下提供安装说明的博客文章:

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-windows-7-x64-and-using-ruby-with-it/

指令适用于mysql gem,但是将其更改为do_mysql应该有效(除了特定于mySQL的示例代码外.

希望会有所帮助.

其他推荐答案

为了删除路易斯的答案,它看起来像这样:

gem install do_mysql -platform = ruby​​---with-mysql-dir =" c:/progra~1/mysql/mysql/mysqls~1.7/"

其中" MySQL-DIR"路径是X64系统上" C:\ Program Files"中的" MySQL Server 5.7"目录的简短版本.

本文地址:https://www.itbaoku.cn/post/786319.html