Patching rbenv install for ruby 1.9.3-p551 on Ubuntu 16.04

I have been reading articles about the complexity of web design lately. I ran into version hell, which is one component of the complexity, headlong yesterday and thought it might be valuable to document my solution for someone trudging along in my footsteps.

I recently rebuilt my local computer with Ubuntu 16.04 and took the opportunity to clean up the crud that builds up. I have been slowly rebuilding my development tools taking care to make good choices about what I keep and what I throw out.

I'm tasked with maintaining an old site built with Drupal 7. It was one of the first sites that I built with D7 and had a lot of hacks and complications so about a year and half ago I rebuilt it. Omega was the hottest theme on the block and I was excited about beginning to work with SASS. I learnt a lot about the process and learnt a lot about ruby in the process. Fast forward to yesterday. I set up my local development site by cloning with git, using Stage File Proxy and a fresh dump of the database. I needed to fix a problem with gallery display on the site and took the opportunity to solve a little problem with the navigation menu wrapping on the top menu. I dropped into scss plopped in my new selector and width then asked compass to rebuild my css.

And down the rabbit hole I went.

A fixed ruby.version - 1.9.3-p551 was required. So I need to set the ruby version as a local version per directory. Now I am one of the weird characters that uses rbenv instead of rvm to manage the disparate versions of ruby that I require. Maybe that's my problem. So when the rbenv install 1.9.3-p551 failed, I didn't think much of it. Just started googling. Discovered that there were a variety of requirements for rbenv to work properly. So into apt-get land I went. And still it failed. Every time I saw the warning that this was a deprecated version of ruby my heart quailed. But that wasn't the problem.

Digging into the log I eventually discovered that it was openssl that was causing the ruby install to fail. And there was a patch. So happily I installed using the patch. (Learned all about using patches in ruby.) Oops still failed. More log digging and googling. I found that the patch was failing. So I went off looking for a better patch. There wasn't one so I started looking at the patch and errors and edited the patch to work with the current version.

Without further ado the openssl patch:


diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 8c04cb5..132d803 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -113,6 +113,9 @@
 unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
  have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TL109")
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index f7cb7f0..47111f6 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -109,9 +109,12 @@ static const struct {
+#if defined(HAVE_SSLV3_METHOD) && defined(HAVE_SSLV3_SERVER_METHOD) && \
+        defined(HAVE_SSLV3_CLIENT_METHOD)

and applied with  cat openssl.patch | rbenv install -v --patch 1.9.3-p551

After installing gem install bundler and bundle install we were off to the races.