0

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

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

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

注意:这里的另一个问题告诉我将DevKit安装文件夹添加到 Environment PATH,我做到了,但仍然遇到同样的错误。

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

有什么解决办法吗?谢谢

4

1 回答 1

1

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

对于 Ruby 1.9.3 及以下版本,我们应该使用DevKit-tdm-32-4.5.2-20111229-1559-sfx.exeThe mingwis for 2.0 及以上版本。

现在效果很好。

于 2013-08-01T05:26:45.217 回答