How to install buildr on Ubuntu Intrepid

I just wanted to compile a program that uses [Ext. Link]buildr. This is an account of the contortions I had to go through to get buildr to build.
If there is one thing that is more annoying than the proliferation of tools meant to replace CVS, it is the proliferation of tool meant to replace make. Because unlike the former, which are a clear step forward, the latter are generally a horrible mess. The example for today: [Ext. Link]buildr.

The failing official way

On the first examination of the situation, it looked like it would be a piece of cake: There is a detailed description on how to build buildr on ubuntu on the buildr site. The only problem with this is that it is outdated and doesn't really work if you try to install on Intrepid. One point is that you no longer have to build gem from source, intrepid already comes with the required version 1.2.0. The next problem is that the command to install buildr doesn' work, if you follow the instruction, the installation fails with:
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
ERROR:  Error installing buildr:
    buildr requires rake (= 0.8.1, runtime)
If you do a quick sudo apt-get install rake, you get the correct version of rake, but trying to build buildr still fails with the same
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
ERROR:  Error installing buildr:
    buildr requires rake (= 0.8.1, runtime)

Some way that at least builds something

So I had to install rake using gem. But just saying
$ sudo gem install rake
doesn't buy you anything, because this will give you rake 0.8.3 and gem will not build buildr unless the version of rake is exactly 0.8.1.

Of course, all of this should not be necessary, because gem claims to be another of these super intelligent tools that automatically resolve your dependencies for you. But, like most programs in this class, it just doesn't work and you have to install all the dependencies of buildr in the exact obsolete versions required by buildr by hand.

So it's

$ sudo gem install rake -v 0.8.1
Successfully installed rake-0.8.1
1 gem installed
Installing ri documentation for rake-0.8.1...
Installing RDoc documentation for rake-0.8.1...
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
ERROR:  Error installing buildr:
	buildr requires net-ssh (= 2.0.4, runtime)
$ sudo gem install net-ssh -v 2.0.4
Successfully installed net-ssh-2.0.4
1 gem installed
Installing ri documentation for net-ssh-2.0.4...
Installing RDoc documentation for net-ssh-2.0.4...
$ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
ERROR:  Error installing buildr:
	buildr requires net-sftp (= 2.0.1, runtime)
and so on, you get the drill. The whole list of required steps is:
sudo gem install rake -v 0.8.1
sudo gem install net-ssh -v 2.0.4
sudo gem install net-sftp -v 2.0.1
sudo gem install highline -v 1.4.0
sudo gem install rubyforge -v 1.0.0
sudo gem install hoe -v 1.7.0
sudo gem install rspec -v 1.1.5
And then finally the big moment:
$ sudo env LANG=C JAVA_HOME=$JAVA_HOME gem install buildr
Successfully installed buildr-1.3.3
Successfully installed rake-0.8.3
Wait... WHAT? It forces you to downgrade rake from 0.8.3 to 0.8.1, only to upgrade to 0.8.3 as part of the build process? You expect me to trust your "outstanding dependency management" if you can't even boostrap your own code without stuff like that?

As an aside, when I was trying to see if another version of buildr would work better, I gave the exact version -v 1.3.2 to gem, and now it resolved the dependencies. Maybe specifying the version would also work for buildr 1.3.3, but I did not test this.

Getting buildr to work

And the reward for it all? This:
Core was generated by `/usr/bin/ruby1.8 /usr/bin/buildr'.
Program terminated with signal 11, Segmentation fault.
[New process 19603]
[New process 19610]
[New process 19606]
[New process 19609]
[New process 19611]
[New process 19607]
[New process 19608]
[New process 19605]
#0  0xb800bf35 in ?? () from /usr/lib/libruby1.8.so.1.8
So off to google we go, looking for buildr and segfault, and find that the official position of the buildr team seems to be [Ext. Link]we don't guarantee anything if you use JDK6. And, indeed, the segfaults vanish if I set JAVA_HOME to /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/.

Half a day gone just to use "something that's simple and intuitive to use".

Florian Hars <florian@hars.de>, 2010-11-09 (orig: 2009-02-14)