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

查看:151
本文介绍了Datamapper的dm_mysql_adapter gem是否支持Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Ruby来玩更多,目前似乎掌握了sinatra,但现在也想从关系数据库中获取数据。我倾向于使用Mysql来测试应用程序,并尝试安装gems,但是当它试图编译它所依赖的原生do_mysql gem时,我一直收到一个异常。



I确实已经安装了原生扩展,并且它们对于JSON gem来说工作得很好,我记得之前回过头来看,do_mysql目前不支持windows,所以只是想知道这是否仍然如此。



在Windows 7上使用ruby 1.9.2(通过ruby安装程序+原生扩展安装)



以下是帮助它的异常:

  C:\dump\ruby\DataMapperTest\gems> gem install dm-mysql-adapter-1.2.0.gem 
暂时增强PATH以包含DevKit ...
构建本机扩展。这可能需要一段时间...
错误:安装dm-mysql-adapter-1.2.0.gem时出错:
错误:无法构建gem本机扩展。

C:/Tools/Ruby192/bin/ruby.exe extconf.rb
检查my_global.h ...没有
检查mysql.h ...没有
在-llibmysql中检查main()... no
在mysql.h中检查mysql_query()... no
在mysql.h中检查mysql_ssl_set()... no
检查localtime_r()... no
检查gmtime_r()... no
检查mysql.h ... no
检查mysql.h中的MYSQL_TYPE_STRING。 .. no
在mysql.h中检查MYSQL_TYPE_BIT ...没有
在mysql.h中检查MYSQL_TYPE_NEWDECIMAL ...没有
在mysql.h中检查mysql_query()...没有
在mysql.h中检查mysql_ssl_set()...没有
在mysql.h中检查mysql_sqlstate()...没有
在mysql.h中检查mysql_get_ssl_cipher()...没有
在mysql.h中检查mysql_set_character_set()...没有
在mysql.h中检查mysql_get_server_version()...没有
在mysql.h中检查MYSQL_FIELD.charsetnr .. 。no
创建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-括号-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-括号-Wpointer-arith -Wwrite-strings
-Wno-missing-field-initializers -Wno-long-long -Wall -o do_mysql .o -c do_mysq
lc
do_mysql.c:5:19:致命错误:mysql.h:没有这样的文件或目录
编译终止。
make:*** [do_mysql.o]错误1


Gem文件将保留在C:/Tools/Ruby192/lib/ruby/gems/1.9.1中/ gems / do_
mysql-0.10.7进行检查。
记录到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添加到系统PATH中。

解决方案

DataMapper和DataObjects(连接到数据库的较低层) do 适用于Windows。

>

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



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

您可以使用MySQL Connector / C接口自己编译do_mysql,它独立于您在计算机中安装的MySQL版本。



请看看这篇提供安装说明的博客文章:

http://blog.mmediasys.com/2011/07/ 07 /斯塔lling-mysql-on-windows-7-x64-and-using-ruby-it-it /



这些指令适用于 mysql gem,但将其更改为 do_mysql 应该可以工作(除了特定于MySQL的示例代码外)



希望有所帮助。


I am wanting to play some more with Ruby and currently seem to have a grasp of sinatra, but would also like to now pull in data from a relational database. I tend to use Mysql for test apps and tried installing the gems but I keep getting an exception when it tries to compile the native do_mysql gem which it is reliant upon.

I do have the native extensions installed and they worked fine for the JSON gem, I remember reading somewhere a while back that the do_mysql wasnt supported for windows currently, so was just wondering if this is still the case.

Using ruby 1.9.2 on windows 7 (installed via ruby installer + native extensions)

Here is the exception incase it helps:

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 community edition is installed and configured and Mysql has been added to the system PATH.

解决方案

DataMapper and DataObjects (the lower layer that connects to the DB) do works on Windows.

However, seems that do_mysql 0.10.7 is missing the precompiled binary for x86-mingw32 platform:

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

You can compile do_mysql yourself using MySQL Connector/C interface, which is independent of the version of MySQL you have installed in your computer.

Please take a look to this blog post which provides installation instructions:

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

The instructions are for mysql gem, but changing it to do_mysql should work (except for the example code which is MySQL specific.

Hope that helps.

这篇关于Datamapper的dm_mysql_adapter gem是否支持Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆