How to make ruby1.8.7 work with openssl 0.9.8?

I have been trying to get this work for several hours without success.

I am trying to use Ruby Amazon AWS lib with requires use of the new
version of openssl.

My macbook tiger comes with built-in openssl 0.9.7i, so I installed
openssl 0.9.8l via macport.

When I issue the following command, it get to the new version:

$ openssl version
OpenSSL 0.9.8l 5 Nov 2009

But when I call openssl within ruby, it keeps looking at the older
version:

$ irb
irb(main):001:0> require ‘openssl’
=> true
irb(main):002:0> OpenSSL::OPENSSL_VERSION
=> “OpenSSL 0.9.7i 14 Oct 2005”

I have tried recompiling ruby, but it didn’t help.

Anyone knows how to fix the problem?

Thanks!

John

I finally got it working. Thanks for Jonny Rogers and his posting:

https://www.ruby-forum.com/topic/195793#871284

That got me thinking in the right direction:

  1. First of all, make sure install the new version of openssl before
    compiling ruby

  2. Then when you compile ruby, tell where your openssl installation so
    the complete steps of ruby install will look like this:

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p160.tar.gz
tar xzvf ruby-1.8.7-p160.tar.gz
cd ruby-1.8.7-p160
./configure --prefix=/usr/local --enable-pthread
–with-readline-dir=/usr/local --with-openssl-dir=/opt/local
–enable-shared
make
sudo make install