Windows 中的 Ruby on Rails:安装 DevKit 时出错
Posted
技术标签:
【中文标题】Windows 中的 Ruby on Rails:安装 DevKit 时出错【英文标题】:Ruby on Rails in Windows: Error in installing DevKit 【发布时间】:2015-05-25 06:26:51 【问题描述】:我是 ROR 的新手,我正在尝试安装 DevKit,但我遇到了一些错误。我使用 Win7-64bit 并安装了 DevKit-mingw64-64-4.7.2-20130224-1432-sfx。 我按照github中的安装。老实说,错误并不清楚,我不知道应该怎么做才能解决问题。
C:\Devkit>type config.yml
This configuration file contains the absolute path locations of all
installed Rubies to be enhanced to work with the DevKit. This config
file is generated by the 'ruby dk.rb init' step and may be modified
before running the 'ruby dk.rb install' step. To include any installed
Rubies that were not automagically discovered, simply add a line below
the triple hyphens with the absolute path to the Ruby root directory.
Example:
--
- C:/ruby19trunk
- C:/ruby192dev
--
c:/Ruby22
然后
C:\Devkit>ruby dk.rb install
[INFO] Skipping existing gem override for ' c:/Ruby22'
[WARN] Skipping existing DevKit helper library for ' c:/Ruby22'
和
C:\Devkit>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
c:/Ruby22/bin/ruby.exe -r ./siteconf20150524-7692-son84q.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating generator-i386-mingw32.def
compiling generator.c
In file included from c:/Ruby22/include/ruby-2.2.0/ruby.h:33:0,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:111:14: error: size of array 'ruby_chec
k_sizeof_voidp' is negative
In file included from c:/Ruby22/include/ruby-2.2.0/ruby.h:33:0,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_obj_freeze_inline':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1156:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1157:2: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1158:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1158:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_data_object_get':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1192:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_obj_written':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1271:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1271:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_num2char_inline':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_class_of':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1670:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_type':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1687:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_append_str':
../fbuffer/fbuffer.h:127:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../fbuffer/fbuffer.h:127:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../fbuffer/fbuffer.h:127:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'convert_UTF8_to_JSON_ASCII':
generator.c:129:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:129:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:129:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:130:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:130:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:130:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'convert_UTF8_to_JSON':
generator.c:227:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:227:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:227:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:228:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:228:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:228:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_configure':
generator.c:559:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:559:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:559:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:560:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:560:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:560:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:567:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:567:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:567:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:568:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:568:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:568:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:575:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:575:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:575:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:576:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:576:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:576:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:583:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:583:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:583:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:584:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:584:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:584:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:591:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:591:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:591:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:592:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:592:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:592:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'set_state_ivars':
generator.c:640:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:640:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:640:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:642:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:642:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:642:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'generate_json_object':
generator.c:727:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:727:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:727:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'generate_json_array':
generator.c:773:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:773:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:773:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'isArrayOrObject':
generator.c:930:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:930:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:930:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:931:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:931:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:931:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_indent_set':
generator.c:1055:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1055:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1055:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1064:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1064:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1064:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_space_set':
generator.c:1093:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1093:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1093:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1102:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1102:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1102:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_space_before_set':
generator.c:1129:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1129:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1129:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1138:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1138:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1138:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_object_nl_set':
generator.c:1167:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1167:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1167:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1175:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1175:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1175:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_array_nl_set':
generator.c:1202:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1202:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1202:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1210:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1210:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1210:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in c:/Ruby22/lib/ruby/gems/2.2.0/gems/json-1.8.2
for inspection.
Results logged to c:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/jso
n-1.8.2/gem_make.out
【问题讨论】:
你在ruby dk.rb install
之前给过这个命令ruby dk.rb init
吗?
是的,我做到了。我都按照github.com/oneclick/rubyinstaller/wiki
我似乎您的 ruby 路径包含空格,请检查是否存在空格,如果路径中有空格,则它不起作用。我好像C:/ruby22
之前有空格@
不,不是。在***中粘贴代码时出现问题,我不得不放置空格。
在这种情况下,我认为您使用的 devkit 和 ruby 版本之间存在版本不匹配。对于特定的 ruby 版本,您需要下载特定的 devkit。见这里***.com/questions/15537191/…。
【参考方案1】:
我遇到了同样的错误,我使用 32 位版本的 devkit 解决了它。
即使我运行的操作系统似乎是 Windows 7 64 位,Ruby 安装程序中的 Ruby 安装似乎是 32 位的,如下所示:
C:\>ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-mingw32]
使用 32 位开发套件 (DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
) 似乎对我有用。
【讨论】:
天哪,我在 Windows 10、64 位和 rubyinstaller-2.2.4 上遇到了同样的问题。我什至懒得看 ruby 版本,但是为什么 rubyinstaller 安装 32 位版本...无论如何,谢谢你的回答。 这是唯一对我有用的解决方案。同样的情况——Win 10 以为我安装了 x64 ruby,但安装的是 32 位。 确认适用于 Windows 10 和 rubyinstaller-2.3.0.exe(声称是 64 位)。ruby -v
还为我提供了 32 位版本。 DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe 无法解决 OP 中的错误,DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe 做到了!跨度>
以上是关于Windows 中的 Ruby on Rails:安装 DevKit 时出错的主要内容,如果未能解决你的问题,请参考以下文章