2nd June 2008

Eurêka! #2

I was giving a try to twitter4r, a library for accessing Twitter’s API in Ruby, with Ruby installed on a Windows (Vista) box, and I was facing a the following problem:

My RoR server was crashing with “Segmentation Fault” somewhere in json/common.rb.

More specifically, it is when calling the timeline_for method that my server was blowing up.

I found the solution to this problem here, but since it is in Japanese, I thought some of you might be happy if I’d translate it in English.

In fact, it’s quite simple: the problem comes form the json library, on which twitter4r depends. If you install twitter4r with gem, as mentioned in their website, the json library is also installed, but the Win32 binaries seem buggy. The good news is there also exists a “pure ruby” implementation of json, and this one works fine. The problem is, if you install it with gem, it won’t be recognized. The solution is therefore to install both json and twitter4r manually.

How do I do that?

  • For json, download json_pure package on RubyForge, uncompress it somewhere, move to the json_pure-x.y.z directory and type the following command in a console: ruby install.rb.
  • As for twitter4r, download the twitter4r package also on RubyForge, uncompress it somewhere, go to the twitter4r-x.y.z\lib directory and copy both the twitter directory and twitter.rb file in Ruby’s library directory (type this ruby -e 'puts $:' to get the list).


posted in Tips | Comments Off on Eurêka! #2