ParseTree in Cygwin

So I had a recent need to get parse_tree (which requires RubyInline and thus a compiler) working in Windows. I was told that I could get it working by using some compiler for Windows, but I figured it might be easier to get it working in Cygwin.

That turned out to be only sort of true.

First up, I installed Cygwin with Ruby. I attempted to use irb, and got ‘cannot find ubygems.’ Googling around led to me to the following solution:

unset RUBYOPT

I then needed to install rubygems from scratch, so I grabbed it into my home directory:

wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz

Unpacked it:

tar -xvf rubygems-0.9.4.tgz

Got into the directory, and installed rubygems:

cd rubygems-0.9.4
ruby setup.rb

I then installed parsetree:

gem install parsetree -y

It installed a bunch of dependencies, including RubyInline. So far so good.

When I attempted to load parse_tree from IRB, I got an error about permissions. After a bunch of searching around, I found the answer: make sure the /cygdrive/c directory is not group or world-writable. The easiest solution is:

chmod 700 /cygdrive/c

If you have special needs, you might need to tweak up the chmod command, but you need to keep it from being group or world writable.

And that was it. I loaded IRB and parse_tree worked great!

1 Comment so far

  1. Francis on July 11th, 2007

    Hi, glad to see your article above!

    Aatually, I’ve faced a problem related to parsetree.

    I installed ruby on windows using the on_click file. And used gem to install the ParseTree.

    But when I run my application based on this environment, an error occured, said loading parsetree and ruby2ruby failed. Check the log file, I found the last code line before exit was in RubyInline.

    Since, I’ve also test the application on evrionment which build by cygwin, so I guess there’s diff when compile and install ParseTree.

    So, could you please tell me how you get success to compile and install it without cygwin? And another question is could I use cygwin just to compile it?

    Further more, I’ve not very fimilar with the process that rubygem compile and install the gems, though I’m very interested in it. Is there info about this you can share with me?

    Thanks a lot!

Leave a reply