Installing Ruby 1.9.3 on openSUSE 12.1 – openssl, zlib and other problems 

I recently decided to expand my skill set by learning Ruby and Rails. I decided upon using JRuby, as I’ve read that it runs faster than regular Ruby, and I’m attracted to the JVM as a programming platform. Initially, that worked great. Installation was as easy as untaring the download, and it comes with everything I needed – gem, rake, and a whole bunch of other tools I was unfamiliar with.

Unfortunately the overhead of starting up the JVM each time became apparent quickly. It isn’t a massive delay, but it’s noticeable. Waiting a second or three to see puts "Hello, world!" run is not conducive to experimenting quickly and learning. I decided to install regular C Ruby on my computer, and leave JRuby for when I have something workable to publish.

At this point in time, openSUSE only officially packages Ruby 1.8.7, and Rails 3 needs Ruby 1.9+, so I had to look elsewhere. I found Ruby 1.9.3 in a devel repo, but installing it from there through Yast broke my gVim install. I considering giving RVM a try, but ultimately decided to attempt to compile it myself.

After downloading Ruby, I tried to compile it and came out with a working Ruby install. I noticed some error pop up while running make, however:

configuring -test-/win32/dln
Failed to configure -test-/win32/dln. It will not be installed.

Ok, I really don’t think I need that.

configuring curses
Failed to configure curses. It will not be installed.

I don’t see myself ever using that, but I guess it’d be nice to have. Whatever.

configuring openssl
Failed to configure openssl. It will not be installed.

That seems pretty important. I should fix that.

Overall, these are the messages it gave me:

Failed to configure -test-/win32/dln. It will not be installed.
Failed to configure curses. It will not be installed.
Failed to configure dbm. It will not be installed.
Failed to configure dl/win32. It will not be installed.
ffi.h is missing. Please install libffi.
Failed to configure fiddle. It will not be installed.
Failed to configure gdbm. It will not be installed.
Failed to configure openssl. It will not be installed.
yaml.h is missing. Please install libyaml.
Failed to configure psych. It will not be installed.
Failed to configure readline. It will not be installed.
Can't find "tk.h".
Can't find proper Tcl/Tk libraries. So, can't make tcltklib.so which is required by Ruby/Tk.
Failed to configure tk. It will not be installed.
Failed to configure win32ole. It will not be installed.
Failed to configure zlib. It will not be installed.

Within irb, when I tried to reference these libraries, it predictably threw an error:

> irb
irb(main):001:0> require 'curses'
LoadError: cannot load such file -- curses
from /usr/local/lib64/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib64/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from /usr/local/bin/irb:12:in `<main>'

Windows stuff aside, I wanted to have as complete an install as possible on my development box, and some of these libraries (openssl, zlib) seemed really important anyways. After some research, I found a blog post by Seth Ladd that seemed to provide some answers.

As root:

# cd /path/to/ruby/source/ext/openssl

  1. ruby extconf.rb

Which led to:

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.

So it wasn’t as easy as that. Make didn’t explicitly tell me that I was missing this ssh.h header file like it did with ffi.h and yaml.h, but apparently it’s not here. The other missing items returned similar errors open running their extconf.rb script. I installed libopenssl-devel through Yast (this also installed zlib-devel) and ran extconf.rb once again. This time it spit out a bunch of output and ended with creating Makefile. So then:

# make

  1. make install

And the moment of truth:

> irb
irb(main):001:0> require 'openssl'
=> true

It works! Zlib also worked just as well. Here’s the full list of those Ruby components and the packages I had to install to for them:

openssl – libopenssl-devel
zlib – zlib-devel
dbm, gdbm – gdbm-devel
psych – libyaml-devel
readline – readline-devel
fiddle – libffi46-devel
tk – tcl-devel, tk-devel