Friday, September 4, 2009

Ruby 1.9.1 on Windows after 1.8.6

I came back to Ruby on Windows the other day after working on a linux box and did not want not be in Cygwin. So I hopped out to ruby-lang.org and pulled in the Windows 1.9.1 binaries. Then I flipped my ruby env variable to point to the new directory so that my path - which uses %ruby%\bin - would update. Then I called gem to install Treetop for PEG and ... Segmentation fault. Oh joy.

I saw that 1.8.6 has a one-click installer for Windows, so I used that, flipped the ruby var and presto all was well.

So why not with the 1.9.1 zip install? Well, ruby for windows XP is not really Ruby for windows so much as it is Ruby for Gnu on Windows. What was missing in the path were Win32 versions of linux DLL's - specifically:
gdbm.dll
libeay32.dll
pdcurses.dll
readline.dll
zlib.dll

The quickest fix was to copy them from the 1.8.6 \bin into the 1.9.1 \bin

So if you start ruby or irb or gem on Windows and hit a Segmentation fault error, this may be the only issue.

You may avoid this issue if you build ruby from source .. but the point of running Ruby on a Windows box outside of Cygwin or Msys is usually to either try something out or get something done - not to do development work. And after all, Ruby is supposed to be at least one notch above its file-based and cmd-line cousin, Gnu Smalltalk, right? Or why else is Ruby seeing so much use on the server-side? Of course if Ruby were to displace that other Smalltalk-descendant, Objective-C, on the iPhone we would be running RIGS for GnuStep anyway ...

Btw, there is Cocotron for that other pseudo-Smalltalk on Windows ...

PS
The DLL's can also be found here.

No comments: