简体   繁体   中英

Rails 3 - no such file to load -- openssl

when running a Rails server, I get the following error: no such file to load -- openssl

I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I get the following:

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.

I cannot use make nor make install.

rvm pkg install openssl (older format - rvm package install openssl )
rvm pkg install iconv (older format - rvm package install iconv )
rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr

Credit to http://www.isnull.com.ar/

检查此说明http://rvm.io/packages/openssl/ - 请记住,快速修复只是一个块而不是整个页面。

You have to install library for openssl/net/http run the following code and then install openssl and iconv.. Following code will work on UBUNTU..

sudo apt-get install libopenssl-ruby1.9.1 this is for ruby 1.9.1.

sudo apt-get install libopenssl-ruby for ruby 1.8.x

first check your rvm having the openssl package. Go to /usr/local/src/rvm/ruby-1.9.2-p290/

then go to ext/openssl.

type ruby extconf.rb If we found errors like this

enter code here
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above

Then install apt-get install libssl-dev.Once installed rub ruby extconf.rb .Now the openssl will get installed

For ubuntu, I did the following:

apt-get install libssl-dev
cd ruby-1.9(source directory used to install ruby)/ext/openssl
ruby extconf.rb
make
make install

This solved the problem for me:

rvm pkg install openssl
rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr

And don't forget to change the ruby version to your version you are using. If you have an old rvm you may should update this at first too.

I made

rvm pkg install openssl
rvm reinstall 1.9.3

and done!

You might want to try running ruby-1.9.2-rc2 instead of head? not sure if it will solve this issue or not, but I did have a lot of problems trying to run under head

pretty sure the the command would look like - rvm install 1.9.2-rc2

you will need to re-install rails again

This error means that your Ruby isn't compiled with openssl. Assuming that you use RVM, these are the steps to follow to fix this issue.

1.Install the openssl package

rvm pkg install openssl

2.Remove the Ruby installation you're using

rvm remove 1.9.3

3.And finally recompile Ruby with openssl

rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr

4.Everything should be working now. Don't forget to:

rvm use 1.9.3 --default

Try the below steps.

  1. rvm get stable
  2. brew install libyaml
  3. rvm pkg install openssl
  4. rvm install ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
  5. rvm use ruby-2.0.0

if you already have ruby version use

rvm reinstall ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM