I recently had to install Ruby Enterprise Edition 2010.02 (yes, it’s old…) on a new VM I had setup with Ubuntu 12.04. The unfortunate thing is that 12.04 ships with GCC 4.6 which seems to have made some subtle changes to the ptr_diff structure that make it incompatible with this older version of REE. Fortunately, there is a simple fix.
The solution is to install GCC 4.4 and use the update-alternatives tool to make 4.4 take precedence over 4.6. This is, fortunately, quite simple:
Install GCC 4.4:
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
Set GCC 4.4 to take precedence:
sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-4.4 100 sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-4.6 50 sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.4 100 sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.6 50 sudo update-alternatives –install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.4 100 sudo update-alternatives –install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.6 50
Now you can merrily install REE 2010.02 without any issues.