Rails 3 - no such file to load -- openssl

Ruby on-RailsRubyRuby on-Rails-3OpensslRvm

Ruby on-Rails Problem Overview


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.

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

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/

Solution 2 - Ruby on-Rails

check this instruction http://rvm.io/packages/openssl/ - keep in mind that the Quick fix is just one block not the whole page.

Solution 3 - Ruby on-Rails

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

Solution 4 - Ruby on-Rails

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

Solution 5 - Ruby on-Rails

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

Solution 6 - Ruby on-Rails

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.

Solution 7 - Ruby on-Rails

I made

rvm pkg install openssl
rvm reinstall 1.9.3

and done!

Solution 8 - Ruby on-Rails

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

Solution 9 - Ruby on-Rails

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

Solution 10 - Ruby on-Rails

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBartView Question on Stackoverflow
Solution 1 - Ruby on-RailsKen Ratanachai S.View Answer on Stackoverflow
Solution 2 - Ruby on-RailsReactormonkView Answer on Stackoverflow
Solution 3 - Ruby on-RailsMuhammad Sannan KhalidView Answer on Stackoverflow
Solution 4 - Ruby on-RailsThillai NarayananView Answer on Stackoverflow
Solution 5 - Ruby on-RailsstebooksView Answer on Stackoverflow
Solution 6 - Ruby on-Railstbraun89View Answer on Stackoverflow
Solution 7 - Ruby on-RailssitesView Answer on Stackoverflow
Solution 8 - Ruby on-Railshouse9View Answer on Stackoverflow
Solution 9 - Ruby on-RailsPraveen GeorgeView Answer on Stackoverflow
Solution 10 - Ruby on-RailsTarkikView Answer on Stackoverflow