在Windows 8上的Ruby DevKit,仍然无法安装原生扩展

时间:2013-08-01 04:50:52

标签: ruby windows

我在Windows8-64bit上使用Ruby 1.9.3。我的Ruby安装在C:\Ruby193,Devkit在C:\DevKit

我按照DevKit安装,这是成功的。

然后指南要求我通过运行gem install json --platform=ruby来测试它,这会返回此错误(看起来与安装DevKit之前类似):

注意:另一个问题here告诉我将DevKit安装文件夹添加到环境PATH,我做了但仍然遇到了同样的错误。< / p>

C:\Users\myname>gem install json --platform=ruby
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make
generating generator-i386-mingw32.def
compiling generator.c
In file included from c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/Ruby193/include/ruby-1.9.1/ruby.h:32,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:/Ruby193/include/ruby-1.9.1/ruby/missing.h:41:8: error: redefinition of 'struc
t timespec'
In file included from c:\devkit\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../.
./../../i686-w64-mingw32/include/process.h:12:0,
                 from c:/Ruby193/include/ruby-1.9.1/ruby/win32.h:62,
                 from c:/Ruby193/include/ruby-1.9.1/ruby/defines.h:223,
                 from c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/Ruby193/include/ruby-1.9.1/ruby.h:32,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:\devkit\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw
32/include/sys/types.h:89:8: note: originally defined here
In file included from c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/Ruby193/include/ruby-1.9.1/ruby.h:32,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:/Ruby193/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struc
t timezone'
In file included from c:/Ruby193/include/ruby-1.9.1/ruby/win32.h:63:0,
                 from c:/Ruby193/include/ruby-1.9.1/ruby/defines.h:223,
                 from c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/Ruby193/include/ruby-1.9.1/ruby.h:32,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:\devkit\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw
32/include/time.h:260:8: note: originally defined here
make: *** [generator.o] Error 1

任何解决方案?感谢

1 个答案:

答案 0 :(得分:1)

抱歉,我使用了错误的DevKit。

对于Ruby 1.9.3及更低版本,我们应该使用DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe mingw适用于2.0及更高版本。

现在效果很好。