I was building and installing Ruby from source as described in this post. The installation failed with this error:
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
To fix this error, install the package that has OpenSSL header and library files required for Ruby to build its OpenSSL extension. On Ubuntu, do this:
$ sudo apt install libssl-dev
Ruby should build and install without any problem after this.
Tried with: Ruby 2.1.5 and Ubuntu 14.04