Installing Ruby-Debug-IDE on Windows

Lately I’ve been trying to find a good development environment for Rails on windows.  I’ve tried several different environments, but so far, I haven’t found that sweet spot, yet.  My latest trial environment is utilizing the new NetBeans version 6.8.  I’ve used NetBeans in the past for PHP projects and I was very happy with it, so I figured if the Rails support was at least as good as the PHP support, it would be a slam dunk.  After installing NetBeans I noticed that it installs it’s own version of ruby (JRuby), which is fine for most people, I’m sure, but I prefer to have my own Ruby environment running the official Ruby releases for Windows.  Something about a Java implementation of Ruby is a turn-off for me, and besides, if I ever wanted to run an alternative Ruby implementation, it would probably end up being IronRuby because Jon Lam and Jimmy Schementi are awesome, and being able to call the .NET framework from within Ruby is very sexy.

Before I get going with NetBeans, I want to make sure my Ruby environment is ready.  The version of Ruby I have installed is from the one-click installer on ruby-lang.org.  The current version is 1.8.6 and it’s about 25 MB.  During installation, it will give you the opportunity to install rubygems, and I always check that box.  Once the installer is finished, you will notice that the “gem” and “ruby” executables have been added to your path.  There are 3 packages that need to be installed after that to get your Rails environment ready:

gem install rails
gem install mongrel
gem install sqlite3-ruby

You’ll get a lot of various “No definition” warnings when installing sqlite3-ruby which can safely be ignored.  When I’m developing locally, I tend to use sqlite3 for my Rails databases because it’s quick and painless.  I also prefer the Mongrel webserver over the default WEBrick because it’s much faster.

Now that Ruby on Rails is ready, I loaded up NetBeans for the first time.  One of the nice things about NetBeans is that it detected my default Rails environment almost immediately, however when examining the settings for this environment, I noticed that the “Classic Debugger” was installed:

image

When I tried to click the “Install Fast Debugger” button, gem spit out some nasty errors about not being able to build the packages from source.  The error it specifically stated that it couldn’t find nmake, despite the fact that I have Visual C++ 2008 Professional installed.  The fix for this error was easy.  I popped open a Visual Studio 2008 Command Prompt:

image

From this prompt, I attempted to install the package manually by running the following command:

gem install ruby-debug-ide

Which ultimately lead to this lovely error:

c:\ruby\lib\ruby\1.8\i386-mswin32\config.h(2) : fatal error C1189: #error :  MSC version unmatch
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

At this point I do a little digging and find this post on RubyForge about building ruby-debug from scratch on Windows.  I’m no C++ guru, but the last comment by Fred Seltzer says:

Hmmm. I just hacked up my copy of config.h to no longer

require the specific version of the C compiler and it built

and ran just fine. I don’t want to go back and revisit

this. Let’s call it closed…

Fredonrails…

Aha!  The light bulb in my head turns on and I decide to go check out this nefarious “config.h” sitting in my Ruby installation (you can see the full path in the error message above).  When I open the config.h, I see the first 3 lines look something like this:

#if _MSC_VER != 1200
#error MSC version unmatch
#endif

After I removed these 3 lines, I tried the command again, and alas, ruby-debug-ide installed!

image

I hope this helps other folks out there to get ruby-debug-ide installed.  I know it’s sort of a pain in the rear, but it worked for me.  I’m pretty sure this will work with Visual C++ 2008 Express, also, but I don’t have it installed so I couldn’t confirm for sure.  If you don’t mind chewing up a little hard drive space, this method will save you some time in the long run.  Happy coding!

Tags: ,

  • Khalil

    I opend the config.h file but , there is no thing like those 3 lines that you talked about
    also i still have the same problem