Building Ruby 1.8.7 on FreeBSD 10

less than 1 minute read

If you try to build Ruby 1.8.7 with RVM you will see:

# rvm install 1.8.7
./lib/fileutils.rb:1430: [BUG] unexpected local variable
ruby 1.8.7 (2012-02-08 patchlevel 375) [amd-freebsd10]
*** [./.rbconfig.time] Signal 6

This is because FreeBSD 10 ships with the Clang compiler instead of GCC and Ruby versions priory to 1.9.3-p194 do not support Clang.

The work-around, is to install GCC, either with pkg:

# pkg install gcc

or from Ports:

# cd /usr/ports/lang/gcc
# make install clean

Once you have gcc you can install 1.8.7 with:

# CC=/usr/local/bin/gcc47 rvm install 1.8.7

This should work with older versions of Ruby 1.9 as well.

What on earth would you want to install 1.8.7? Two words: Legacy Apps…