This mostly happened on CentOS 64

Solution:

rpm -qi ruby

Name : ruby Relocations: (not relocatable)

Version : 1.8.7.299 Vendor: AegisCo

then get the source package with the same version.

cd /usr/src/redhat/SOURCES/ruby-1.8.7-p299/ext/openssl/

ruby extconf.rb

make

make install