Cannot load such file -- openssl (again)

This problem has been discussed a number of times, but none of the given
solutions seems to work for me.

Problem:
Trying to generate the infrastructure for testing with Cucumber gives
the following error

~/…/OTK-register$ rails generate cucumber:install
/home/tpollak/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in
require': cannot load such file -- openssl (LoadError) from /home/tpollak/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:inblock in require’

/gems/railties-3.2.1/lib/rails/application.rb:103:in
require_environment!' from /home/tpollak/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:25:in<top (required)>’
from script/rails:6:in require' from script/rails:6:in

My environment is Ubuntu 11.10, Rails 3.2.1, ruby 1.9.3p0 (2011-10-30
revision 33570) [i686-linux]

and

~/…/OTK-register$ bundle install
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Using activesupport (3.2.1)
Using builder (3.0.0)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.1)
Using rack (1.4.1)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.1)
Using actionmailer (3.2.1)
Using arel (3.0.0)
Using tzinfo (0.3.31)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bundler (1.0.22)
Using nokogiri (1.5.0)
Using ffi (1.0.11)
Using childprocess (0.3.1)
Using rubyzip (0.9.6.1)
Using selenium-webdriver (2.19.0)
Using xpath (0.1.4)
Using capybara (1.1.2)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using diff-lcs (1.1.3)
Using gherkin (2.7.7)
Using term-ansicolor (1.0.7)
Using cucumber (1.1.4)
Using cucumber-rails (1.2.1)
Using database_cleaner (0.7.1)
Using mysql2 (0.3.11)
Using rails (3.2.1)
Using rspec-core (2.8.0)
Using rspec-expectations (2.8.0)
Using rspec-mocks (2.8.0)
Using rspec (2.8.0)
Using rspec-rails (2.8.1)
Using sass (3.1.15)
Using sass-rails (3.2.4)
Using uglifier (1.2.3)
Your bundle is complete! Use bundle show [gemname] to see where a
bundled gem is installed.

and

~$ ls /////openssl* | grep openssl
/usr/bin/X11/X11/openssl
/usr/lib/i386-linux-gnu/pkgconfig/openssl.pc
/usr/lib/ruby/1.8/openssl.rb
/usr/lib/ruby/1.9.1/openssl.rb
/usr/share/doc/openssl/openssl_button.gif
/usr/share/doc/openssl/openssl_button.html
/usr/share/doc/openssl/openssl.txt.gz
/usr/share/man/man1/openssl.1ssl.gz
/var/cache/apt/archives/openssl_1.0.0e-2ubuntu4.2_i386.deb
/var/lib/dpkg/info/openssl.conffiles
/var/lib/dpkg/info/openssl.list
/var/lib/dpkg/info/openssl.md5sums
/var/lib/dpkg/info/openssl.postinst
/usr/lib/ruby/1.8/openssl:
/usr/lib/ruby/1.9.1/openssl:

I have seen solutions for users of RVM (remove ruby and reinstall with
directory path for openssl, but can not adjust them for rbenv and my
installation of openssl.

Does somebody know how to fix the problem?

Regards

Tommy P.
Wiboms v 12, 2 tr
S-171 60 SOLNA
Sweden

On Tue, Feb 14, 2012 at 6:01 PM, Tommy P. [email protected]
wrote:

from
My environment is Ubuntu 11.10, Rails 3.2.1, ruby 1.9.3p0 (2011-10-30
Using activemodel (3.2.1)
Using polyglot (0.3.3)
Using childprocess (0.3.1)
Using thor (0.14.6)
Using rspec-core (2.8.0)
and
/var/cache/apt/archives/openssl_1.0.0e-2ubuntu4.2_i386.deb

Does somebody know how to fix the problem?

I don’t know for rbenv, but usually this gets fixed when you have your
openssl dev files in an standard location at the time you compile
ruby.
Make sure of that and make sure you force the re-building of ruby.
(including the ./configure step).

HTH


Leonardo M…
There’s no place like ~

Openssl is located in /usr/lib/ruby/1.9.1. Is that a standard
location?

The version is openssl.rb 25189 2009-10-02 12:04:37Z akr. Is this the
correct version?

How do I enforce a rebuild of Ruby? Because a possible cause of the
problem is that openssl was added after the installation of Ruby.

On 14 Feb, 22:46, Leonardo M. [email protected] wrote:

`require’: cannot load such file – openssl (LoadError)
from

On Tue, Feb 14, 2012 at 7:32 PM, Tommy P. [email protected]
wrote:

Openssl is located in /usr/lib/ruby/1.9.1. Is that a standard
location?

The version is openssl.rb 25189 2009-10-02 12:04:37Z akr. Is this the
correct version?
This might be the ruby-openssl package, you need the plain openssl
package and also the dev files for openssl. If you’re using a debian
based distro the package should be named openssl-dev.

How do I enforce a rebuild of Ruby? Because a possible cause of the
problem is that openssl was added after the installation of Ruby.

I’m not an rbenv user but try removing the installation and re install
it again. I know RVM caches the sources and you have to force the
re-configuration, but I don’t know if rbenv does the same thing.
I know for sure ruby-build doesn’t cache the sources and probably
rbenv wont, however, I cannot ensure that.

Hope it helps.

Cheers.


Leonardo M…
There’s no place like ~

On Wed, Feb 15, 2012 at 3:14 PM, Tommy P. [email protected]
wrote:

the problem was that Openssl was installed AFTER Ruby was built.
Great!
And sure, you need openssl (dev and library) files at ruby buildtime.

Glad it helped.

Leonardo M…
There’s no place like ~

Thanks for the tips, Leonardo.

It works now. What did I do?

a - removed the ruby/rails installation by deleting the
directory …/.rbenv/versions/1.9.3-p0

b - restarting the installation from scratch

Note that I left all of Openssl installed. I guess that the cause for
the problem was that Openssl was installed AFTER Ruby was built.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs