Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install json fails with redifinition of struct timezone/timespec

I am on Windows with Ruby 1.9.3 with DevKit (all 32 bit on Win 7 64 bit). Now I try to install rails, but get an error from bundle. If I try to run (what bundle is complaining about)

 gem install json

I get the following error message:

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

Any idea?

like image 367
Henno Avatar asked Feb 27 '13 20:02

Henno


1 Answers

Ruby 1.9.3 was compiled with GCC 4.5.2, which is DevKit DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe available from RubyInstaller's download page

You downloaded the newer DevKits, that are only compatible with Ruby 2.0.0 release, as indicated in RubyInstaller announcement.

To clarify:

  • Ruby 1.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 (and 64bits version for 64bits Ruby)

I've added a clarification to RubyInstaller download page about this.

Hope that helps

like image 115
Luis Lavena Avatar answered Sep 23 '22 04:09

Luis Lavena