0

I'm having an issue with an uncooperative EC2 Ubuntu 10.04 4 LTS instance. I'm trying to install a few prerequisites for a Ruby web app which has the following dependencies:

require 'rubygems'
require 'webrick/https'
require 'OpenSSL'
require 'Plist'
require 'uuidtools'
require 'uri'
require 'net/http'
require 'net/https'
require 'net/protocol'
require 'json'
require 'htmldiff'

I have no issue installing uuidtools, uri, json, htmldiff or plist, however, when I try to run the server.rb app I receive this error:

/home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- OpenSSL (LoadError)
    from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from server.rb:4:in `<main>'

I have the Ubuntu repository default 1.8 as well as 1.9.3p125 (which was installed via rvm). For each version I have the appropriate headers/dev packages installed. I've tried removing 1.8 and reinstalling 1.9.3 as well as the openssl library with no luck - I still receive the same message.

Bart De Vos
  • 17,761
  • 6
  • 62
  • 81
upbeat.linux
  • 275
  • 4
  • 12

3 Answers3

1

If you didn't have the openssl-devel installed when you did "rvm install", you may have to do "rvm reinstall". Something like:

rvm reinstall 1.9.3-p125

Basically, Ruby may not have compiled with OpenSSL the first time around.

cjc
  • 24,533
  • 2
  • 49
  • 69
  • Thanks cjc! Although that didn't work I did find the bug. OpenSSL (Windows) doesn't exist in gems but openssl (*nix) does. Corrected that and it ran without issue. I wrote a deploy script to make the modifications after the developer commits new code. Thanks for your help. – upbeat.linux Mar 05 '12 at 04:44
1

The OpenSSL dependency existed on the developers Windows environment

require 'OpenSSL'

while the code was meant to deploy on Linux where the requirement is openssl.

require 'openssl'

I made the switch and was able to connect.

upbeat.linux
  • 275
  • 4
  • 12
0

Just execute the below set of commands:

sudo apt-get install libssl-dev

cd your_ruby_path/ext/openssl

ruby ruby extconf.rb

make

make install

loganathan
  • 240
  • 2
  • 13