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
check this instruction http://rvm.io/packages/openssl/ - keep in mind that the Quick fix is just one block not the whole page.
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.
rvm pkg install openssl rvm reinstall 1.9.3
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