I'm trying to install ruby 1.8.6 on CentOS7 and successfully finished, but ruby cannot load openssl.

My install steps are below.

Install openssl 0.9.8 from source.

wget http://www.openssl.org/source/openssl-0.9.8zb.tar.gz
tar xzf openssl-0.9.8zb.tar.gz
cd openssl-0.9.8zb
./config --prefix=/usr/local shared
make && make install
openssl version
OpenSSL 0.9.8zb 6 Aug 2014

Install ruby 1.8.6 from source.

# Fix timeout.rb:59: [BUG] Segmentation fault
export CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls"

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p420.tar.gz
tar xvfvz ruby-1.8.6-p420.tar.gz 
cd ruby-1.8.6-p420
make && make install
ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]

These steps are finished without error, but ruby cannot load openssl.

irb(main):001:0> require 'openssl'
LoadError: libssl.so.0.9.8: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.8/x86_64-linux/openssl.so
    from /usr/local/lib/ruby/1.8/x86_64-linux/openssl.so
    from /usr/local/lib/ruby/1.8/openssl.rb:17
    from (irb):1:in `require'
    from (irb):1

The error shows that cannot open 'openssl.so' but the file exists at /usr/local/lib/ruby/1.8/x86_64-linux/openssl.so.

ls /usr/local/lib/ruby/1.8/x86_64-linux/openssl.so

Any suggestions would be appreciated. Thanks in advance.

  • 2
    Dear God why? Just fix the Ruby code so that it runs in this decade. – Michael Hampton Jul 30 '15 at 3:39

I solved the problem myself. Here is what I did.

# cd to openssl directory in ruby source directory
cd ruby-1.8.6-p420/ext/openssl
ruby extconf.rb
make && make install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.