Archive for October, 2009

compiling Ruby 1.8.6 on Snow Leopard

October 5, 2009

I recently got a new MacBook Pro running Snow Leopard. I mostly got everything working the way I wanted it, but I found that the default Ruby installation is now 1.8.7, which doesn’t work for us – because we use WSS4R which is only compatible up to 1.8.6 (I wish this weren’t so, hoping to persuade the maintainer to patch and upgrade)

So I decided to download the source for Ruby 1.8.6 and install it in /usr/local – adapting very helpful instructions found on Hivelogic here

It turns out though that you can’t compile versions of Ruby pre 1.8.7p72 on Snow Leopard. I ran into this error on my new laptop and also on a colleague’s older one which he had upgraded with a Snow Leopard upgrade disc. When running make, the following error is thrown:

In file included from openssl_missing.c:22:
openssl_missing.h:119: error: conflicting types for 'BN_rand_range'
/usr/include/openssl/bn.h:411: error: previous declaration of 'BN_rand_range' was here
openssl_missing.h:120: error: conflicting types for 'BN_pseudo_rand_range'
/usr/include/openssl/bn.h:412: error: previous declaration of 'BN_pseudo_rand_range' was here
make[1]: *** [openssl_missing.o] Error 1
make: *** [all] Error 1

There are quite a few hits on this on Google, mainly relating to various Linux distros. Based on this Gentoo patch I figured you need to download the Ruby 1.8.7p72 tarball, and copy the following files from it to your 1.8.6 source:

(all subdirectories relative to the source root)

Having done that I reran the ./configure, and then tried make again – and it worked.

No idea what the patched files do, but all seems stable so far.