I'm no Ruby expert but a friend of mine was asking me how to write a simple XMPP bot using Ruby, and I had seen a couple of recent posts announcing a simple ruby library.
So after installing RubyGems (I had a total virgin Mac OS X stock install of Ruby), I did the usual:
sudo gem install xmpp4r-simple
That did not work well. One of the dependencies,
rcov, does not install in my system. The error message is something like this:
gcc -fno-common -g -Os -pipe -fno-common -pipe -fno-common -pipe -fno-common -I. -I/usr/lib/ruby/1.8/universal-darwin8.0 -I/usr/lib/ruby/1.8/universal-darwin8.0 -I. -c callsite.c callsite.c:121: error: parse error before 'event' callsite.c: In function 'coverage_event_callsite_hook': callsite.c:131: error: 'klass' undeclared (first use in this function) callsite.c:131: error: (Each undeclared identifier is reported only once callsite.c:131: error: for each function it appears in.) callsite.c:136: error: 'mid' undeclared (first use in this function) callsite.c:141: error: 'node' undeclared (first use in this function) callsite.c: In function 'cov_install_callsite_hook': callsite.c:162: error: 'RUBY_EVENT_CALL' undeclared (first use in this function) make: *** [callsite.o] Error 1
To solve this, I did the following: first I manually downloaded the latest version of
rcov from the rcov site. Doing the classic
ruby setup.rb dies with the same error, but there is an alternative:
sudo ruby setup.rb all --without-ext
This works. Basically it skips installation of a C-based extension to the
rcov package that makes the package a lot faster. Given that I don't intend to run coverage tests in ruby, I don't mind skipping this.
At this time,
gem install xmpp4r-simple still tries to install the dependency of
rcov although we already have
rcov installed. So we skip the dependencies:
sudo gem install --ignore-dependencies xmpp4r-simple
This works, and now we can play.