首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gem install json失败,并重新定义struct timezone/timespec

gem install json失败,并重新定义struct timezone/timespec
EN

Stack Overflow用户
提问于 2013-02-28 04:00:29
回答 2查看 7.2K关注 0票数 8

我在Windows上使用Ruby1.9.3和DevKit (在Win7 64位上都是32位)。现在我尝试安装rails,但从bundle中得到一个错误。如果我尝试运行( bundle抱怨的是什么)

代码语言:javascript
复制
 gem install json

我得到以下错误消息:

代码语言:javascript
复制
D:\RubyTest>gem install json
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.

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

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


Gem files will remain installed in D:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.
7 for inspection.
Results logged to D:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/ge
nerator/gem_make.out

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-02-28 05:46:14

Ruby1.9.3是用DevKit提供的DevKit DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe软件-- GCC 4.5.2编译而成的

您下载了较新的DevKits,它只有兼容Ruby2.0.0版本,正如RubyInstaller公告中指出的那样。

澄清一下:

Ruby1.8.7:tdm-32-4.5.2

  • Ruby 1.9.2:tdm-32-4.5.2

  • Ruby 1.9.3:tdm-32-4.5.2

  • Ruby 2.0.0:mingw64-32-4.7.2 (64位版本)

我已经在RubyInstaller下载页面上添加了关于这一点的说明。

希望这能有所帮助

票数 22
EN

Stack Overflow用户

发布于 2016-08-07 05:57:17

你可以打开你的ruby版本的include目录中的"win32.h“。

然后注释掉声明了"clock_gettime“"clock_getres”函数的行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15121247

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档