问题
I am trying to install devkit and then to install json gem on Windows7 64bits, I have installed ruby 4.2.4 & extracted devkit configured config.yml and run ruby dk.rb install and then when i run gem install JSON --platform=ruby but it gives error as follows :
current directory: C:/Ruby22/lib/ruby/gems/2.2.0/gems/json-1.8.3/ext/json/ext/generator
C:/Ruby22/bin/ruby.exe -r ./siteconf20160205-1668-13fh07v.rb extconf.rb
creating Makefile
current directory: C:/Ruby22/lib/ruby/gems/2.2.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
current directory: C:/Ruby22/lib/ruby/gems/2.2.0/gems/json-1.8.3/ext/json/ext/generator
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_check_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:553:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:553:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:553:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:554:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:554:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:554:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:561:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:561:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:561:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:562:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:562:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:562:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:569:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:569:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:569:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:570:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:570:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:570:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:577:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:577:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:577:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:578:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:578:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:578:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:585:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:585:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:585:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:586:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:586:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:586:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'set_state_ivars':
generator.c:634:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:634:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:634:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:636:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:636:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:636:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'generate_json_object':
generator.c:721:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:721:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:721:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'generate_json_array':
generator.c:767:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:767:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:767:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'isArrayOrObject':
generator.c:924:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:924:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:924:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:925:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:925:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:925:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_indent_set':
generator.c:1049:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1049:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1049:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1058:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1058:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1058:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_space_set':
generator.c:1087:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1087:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1087:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1096:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1096:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1096:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_space_before_set':
generator.c:1123:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1123:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1123:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1132:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1132:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1132:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_object_nl_set':
generator.c:1161:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1161:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1161:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1169:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1169:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1169:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c: In function 'cState_array_nl_set':
generator.c:1196:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1196:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1196:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1204:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1204:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generator.c:1204:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
make: *** [generator.o] Error 1
make failed, exit code 2
回答1:
For posterity, I asked basically the same question and Azolo noticed that it was because I had the wrong, x86 version of Ruby installed instead of x64 which matches my machine and devkit. Deleting the old one and downloading an x64 version of Ruby fixed my issue.
来源:https://stackoverflow.com/questions/35222449/error-failed-to-build-json-gem-native-extension-on-windows-7x64