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.
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
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?
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.
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
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
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?
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'
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
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?