Monday, June 17, 2013

Ruby on Rails (on Windows) - "ruby_check_sizeof_voidp is negative"

Today I installed Ruby on Rails on my Windows machine, but had to jump through a few hoops to get it done. The biggest stumbling block was that whenever I got down to executing "rails new myapp", I got a long error that started with

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.h:32:0,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:109:14: error: size of array 'ruby_check_sizeof_voidp' is negative
In file included from c:/Ruby193/include/ruby-1.9.1/ruby.h:32:0,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:


and ended with

make: *** [generator.o] Error 1

and some version of the message "make sure the json gem was installed correctly" and "log errors will be stored at C:\Ruby193\lib\ruby\gems\1.9.1\gems\json-1.8.0\ext\json\ext\generator\gem_make.out".

So I tried "gem install json -v '1.8.0'" (sometimes with "--platform=ruby") but I still received errors. Then I actually looked at gem_make.out and sow the following line: "c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:109:14: error: size of array 'ruby_check_sizeof_voidp' is negative".

Cue this StackOverflow post, and I realized that I did not install the correct Devkit. I so wanted to work with the latest release of everything that I ignored the "Which Development Kit?" section of this Ruby Installer for Windows page.

I reinstalled Devkit (following the instructions here) and actually created my new web app. Now, I have Ruby 1.9.3 working with Rails 3.2.13 and the tdm-32-4.5.2 version of DevKit installed.