no such file to load -- openssl (LoadError) - Deperate for solution after 3 days

no such file to load -- openssl (LoadError) - Deperate for solution after 3 days

Does anybody have an answer, or ever some explanation of the “no such file to load – openssl”?

I have been trying to get RoR working on Ubuntu 10.10 for 3 days now and keep hitting the same problem.

I have worked through all of the following posts, trying each in turn, without joy:

http://railsforum.com/viewtopic.php?id=25874 http://railsforum.com/viewtopic.php?id=39587

http://www.theodorenguyen-cao.com/2011/05/20/no-such-file-to-load-openssl-runtimeerror/ http://stackoverflow.com/questions/3464098/rails-3-no-such-file-to-load-openssl

Even an explanation of what this error means, and what the root cause could be. Most of the posts say things like “install X” and it will be fixed. But those are not working for me.

Please help! This is driving me crazy!

Rob

no such file to load -- openssl (LoadError) - Deperate for solution after 3 days

Does anybody have an answer, or ever some explanation of the “no such file to load – openssl”?

I have been trying to get RoR working on Ubuntu 10.10 for 3 days now and keep hitting the same problem.

It means that the ruby bindings for OpenSSL aren't present (or more rarely they are present but there is an issue with the OpenSSL library itself). How you fix it depends on how you've installed ruby, but usually involves having the development headers for OpenSSL installed before you install ruby itself, or if using the ruby that is supplied by the OS, installing a package which has the ruby OpenSSL bindings

Fred

Fred,

Thank you for your fast reply!

I installed OpenSSL like this

# sudo apt-get install libopenssl-ruby1.8 Reading package lists... Done

Building dependency tree

Reading state information... Done

Note, selecting 'libruby1.8' instead of 'libopenssl-ruby1.8'

libruby1.8 is already the newest version.

libruby1.8 set to manually installed.

The following packages were automatically installed and are no longer required:

  libjna-java libswing-layout-java javahelp2 libfelix-main-java visualvm libfelix-framework-java libnb-platform12-java

Use 'apt-get autoremove' to remove them.

0 upgraded, 0 newly installed, 0 to remove and 227 not upgraded.

Then I installed ruby like this:

$ sudo apt-get install ruby1.9.1 Reading package lists... Done Building dependency tree Reading state information... Done ruby1.9.1 is already the newest version. The following packages were automatically installed and are no longer required:   libjna-java libswing-layout-java javahelp2 libfelix-main-java visualvm libfelix-framework-java libnb-platform12-java Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 227 not upgraded.

Is there a way to check the ruby bindings for OpenSSL?

Rob

Please, do yourself a favor and use RVM[1] or rbenv[2] to install Ruby. I can only detail RVM usage for this, since it's the one I use, but feel free to google some info about rbenv.

For installing ruby on Debian-like OS, make sure you purge all the ruby related packages you have installed before from apt-get/aptitude, then install libopenssl-dev, libsqlite-dev, libxslt1-dev, libxml2-dev and libreadline-dev packages (Note: I'm not sure the exact name of the packages, so you must search the packages to get the exact name), then install RVM following the instruction on it's website, and install ruby by doing:

rvm install ruby-1.9.3 This will download, configure and compile it with preconfigured options which will make use of the libraries you installed before.

After you have done this, you can start using ruby and installing gem by the gem command.

Hope this help.

Cheers!

[1]https://rvm.beginrescueend.com/rvm [2]https://github.com/sstephenson/rbenv

Leonardo,

Thank you for your suggestions. I just went through your instructions, de-installed ruby, installed the libraries, installed rvm and used rvm to install the latest version.

But no luck I am afraid. The error message on starting rails server is exactly the same, as follows:

$ rails server => Booting WEBrick => Rails 3.1.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `require': no such file to load -- openssl (LoadError)   from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `block in require'   from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:223:in `block in load_dependency'   from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:640:in `new_constants_in'   from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:223:in `load_dependency'   from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `require'   from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/session/ cookie.rb:1:in `<top (required)>' ... etc.

I really don't get this because when I do an: $ rvm requirements

it tells me...

Additional Dependencies: # For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:   ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml- dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

I run the apt-get, before running rails, to ensure that all of these dependencies are loaded, but it still gives the error.

I can see that openssl is included. So why can't it find it?

Rob

Leonardo,

Thank you for your suggestions. I just went through your instructions, de-installed ruby, installed the libraries, installed rvm and used rvm to install the latest version.

But no luck I am afraid. The error message on starting rails server is exactly the same, as follows:

$ rails server => Booting WEBrick => Rails 3.1.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `require': no such file to load -- openssl (LoadError) from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `block in require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:223:in `block in load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:640:in `new_constants_in' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:223:in `load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/ active_support/dependencies.rb:240:in `require' from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/session/ cookie.rb:1:in `<top (required)>' ... etc.

I really don't get this because when I do an: $ rvm requirements

it tells me...

Additional Dependencies: # For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml- dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

I run the apt-get, before running rails, to ensure that all of these dependencies are loaded, but it still gives the error.

Did you install all the dependencies before you compiled Ruby?

I can see that openssl is included. So why can't it find it?

The only thing I can think of is the dev files for openssl are either not properly installed or installed on a non-standard place and you have to specify the configure process where to find them before compiling Ruby. But all this sounds weird for me, since I've installed Ruby several times on Debian-like distros with RVM (even when I'm not a Debian-like user) and never had this issue.

If it's still not working, can you paste here where your openssl files are located?

Cheers

Leonardo,

Still not working I am afraid..Thank you for your continuing help.

Synaptics package manager tells me that openssl files are here:

/etc/ssl /etc/ssl/certs /etc/ssl/openssl.cnf /etc/ssl/private /usr /usr/bin /usr/bin/c_rehash /usr/bin/openssl /usr/lib /usr/lib/ssl /usr/lib/ssl/certs /usr/lib/ssl/misc /usr/lib/ssl/misc/CA.pl /usr/lib/ssl/misc/CA.sh /usr/lib/ssl/misc/c_hash /usr/lib/ssl/misc/c_info /usr/lib/ssl/misc/c_issuer /usr/lib/ssl/misc/c_name /usr/lib/ssl/openssl.cnf /usr/lib/ssl/private

and

libssl-dev are here:

/. /usr /usr/include /usr/include/openssl /usr/include/openssl/aes.h /usr/include/openssl/asn1.h /usr/include/openssl/asn1_mac.h /usr/include/openssl/asn1t.h /usr/include/openssl/bio.h /usr/include/openssl/blowfish.h /usr/include/openssl/bn.h /usr/include/openssl/buffer.h /usr/include/openssl/cast.h /usr/include/openssl/comp.h /usr/include/openssl/conf.h /usr/include/openssl/conf_api.h /usr/include/openssl/crypto.h /usr/include/openssl/des.h /usr/include/openssl/des_old.h /usr/include/openssl/dh.h /usr/include/openssl/dsa.h /usr/include/openssl/dso.h /usr/include/openssl/dtls1.h /usr/include/openssl/e_os2.h /usr/include/openssl/ebcdic.h /usr/include/openssl/ec.h /usr/include/openssl/ecdh.h /usr/include/openssl/ecdsa.h /usr/include/openssl/engine.h /usr/include/openssl/err.h /usr/include/openssl/evp.h /usr/include/openssl/hmac.h /usr/include/openssl/krb5_asn.h /usr/include/openssl/kssl.h /usr/include/openssl/lhash.h /usr/include/openssl/md2.h /usr/include/openssl/md4.h /usr/include/openssl/md5.h /usr/include/openssl/obj_mac.h /usr/include/openssl/objects.h /usr/include/openssl/ocsp.h /usr/include/openssl/opensslconf.h /usr/include/openssl/opensslv.h /usr/include/openssl/ossl_typ.h /usr/include/openssl/pem.h /usr/include/openssl/pem2.h /usr/include/openssl/pkcs12.h /usr/include/openssl/pkcs7.h /usr/include/openssl/pq_compat.h /usr/include/openssl/pqueue.h /usr/include/openssl/rand.h /usr/include/openssl/rc2.h /usr/include/openssl/rc4.h /usr/include/openssl/ripemd.h /usr/include/openssl/rsa.h /usr/include/openssl/safestack.h /usr/include/openssl/sha.h /usr/include/openssl/ssl.h /usr/include/openssl/ssl2.h /usr/include/openssl/ssl23.h /usr/include/openssl/ssl3.h /usr/include/openssl/stack.h /usr/include/openssl/store.h /usr/include/openssl/symhacks.h /usr/include/openssl/tls1.h /usr/include/openssl/tmdiff.h /usr/include/openssl/txt_db.h /usr/include/openssl/ui.h /usr/include/openssl/ui_compat.h /usr/include/openssl/x509.h /usr/include/openssl/x509_vfy.h /usr/include/openssl/x509v3.h /usr/lib /usr/lib/libcrypto.a /usr/lib/libcrypto.so /usr/lib/libssl.a /usr/lib/libssl.so /usr/lib/pkgconfig /usr/lib/pkgconfig/libcrypto.pc /usr/lib/pkgconfig/libssl.pc /usr/lib/pkgconfig/openssl.pc

Regards

Rob

This is weird, since your openssl dev files are in the standard location and should be found. The last thing I can suggest is to remove the ruby installation with: rvm remove ruby-1.9.3

Then, reinstall it with: rvm install ruby-1.9.3

If this doesn't help, check the file ~/.rvm/log/ruby-1.9.3-p0/make.log for mentions to openssl. You should find there something like: [kandalf@funkymonkey ruby-1.9.3-p0]$ grep openssl make.log configuring openssl make[2]: Entering directory `/home/kandalf/.rvm/src/ruby-1.9.3-p0/ext/openssl' compiling openssl_missing.c linking shared-object openssl.so installing default openssl libraries make[2]: Leaving directory `/home/kandalf/.rvm/src/ruby-1.9.3-p0/ext/openssl'

The output above is the one from my laptop.

Leonardo,

I did the re-install as below, then searched the build log as suggested (also below). Mine looks almost identical to yours, unless I am missing something. But the results are the same. I am really stumped.

Grateful for any more suggestions - or diagnostics that I could run to check out the build and install.

Rob

$ rvm install ruby-1.9.3 Installing Ruby from source to: /home/rob/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...

ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection...   % Total % Received % Xferd Average Speed Time Time Time Current                                  Dload Upload Total Spent Left Speed 100 9330k 100 9330k 0 0 55239 0 0:02:52 0:02:52 --:--:-- 54288 ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /home/rob/.rvm/src/ ruby-1.9.3-p0 ruby-1.9.3-p0 - #extracted to /home/rob/.rvm/src/ruby-1.9.3-p0 Fetching yaml-0.1.4.tar.gz to /home/rob/.rvm/archives Extracting yaml-0.1.4.tar.gz to /home/rob/.rvm/src Prepare yaml in /home/rob/.rvm/src/yaml-0.1.4. Configuring yaml in /home/rob/.rvm/src/yaml-0.1.4. Compiling yaml in /home/rob/.rvm/src/yaml-0.1.4. Installing yaml to /home/rob/.rvm/usr ruby-1.9.3-p0 - #configuring ruby-1.9.3-p0 - #compiling ruby-1.9.3-p0 - #installing Removing old Rubygems files... Installing rubygems-1.8.10 for ruby-1.9.3-p0 ... Installation of rubygems completed successfully. ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p0 - #importing default gemsets (/home/rob/.rvm/gemsets/) Install of ruby-1.9.3-p0 - #complete

$ grep openssl make.log configuring openssl make[2]: Entering directory `/home/rob/.rvm/src/ruby-1.9.3-p0/ext/ openssl' compiling openssl_missing.c linking shared-object openssl.so installing default openssl libraries make[2]: Leaving directory `/home/rob/.rvm/src/ruby-1.9.3-p0/ext/ openssl' rob@Ubuntu-Dell-XPS420:~/.rvm/log/ruby-1.9.3-p0$

Find here a detailed RoR installation tutorial, including how to solve that error message: Ruby on Rails 3.1 Installation – Ubuntu (11.04, 11.10) and Linux Mint (11, 12) | Mircea Goia

Mircea

Mircea,

Thank you. I just downloaded your instructions. They look really detailed, and exactly the kind of thing I have been looking for.

I will give them a go and let you know how I get on.

Regards

Rob

hope you have updated rvm to latest version (rvm update) before installing ruby 1.9.3.

regards shireesh

Leonardo,

I did the re-install as below, then searched the build log as suggested (also below). Mine looks almost identical to yours, unless I am missing something. But the results are the same. I am really stumped.

Grateful for any more suggestions - or diagnostics that I could run to check out the build and install.

After that, did you use rvm use to tell it that you wante to use the ruby you've just compiled?

Fred

Hav u installed the following packages openssl libopenssl-ruby libssl-dev

Mehdi

Check this tutorial I've made: Ruby on Rails 3.1 Installation – Ubuntu (11.04, 11.10) and Linux Mint (11, 12) | Mircea Goia There you can find the error you are having here and see the solution...

Mircea