cannot load such file -- openssl

[test@localhost usr]$ /usr/local/ruby/bin/gem install bundler
ERROR:  Loading command: install (LoadError)
	cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

 在用源码安装ruby之后,想要安装bundler,却报出上面错误

curl -sSL https://get.rvm.io | bash
rvm pkg install openssl

重新编译

./configure --prefix=/opt/ruby20 --with-openssl-dir=/home/test/.rvm/usr

最后可能会提示如下的错误,不用管他

configure: WARNING: unrecognized options: --with-openssl-dir

make
make install

 没有问题了

[root@localhost ruby-2.0.0-p598]# /opt/ruby20/bin/gem install bundler -V
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz

如果报出这个警告:

'rvm pkg ...' is deprecated

则采用

rvm autolibs
原文地址:https://www.cnblogs.com/ghgyj/p/4107091.html