8

I'm trying to setup github-pages on my Ubuntu laptop, and following the guide provided by Github I have to install the bundler package; giving the command

~$ gem install bundler

returns me this error.

ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

Then I have installed OpenSSL, launched the command to update software and stuff and tried again to install bundler, but the error kept showing.

How can I fix this? Is there any specific command to rebuild ruby making it aware about the fact that openSSL is now installed?

  • 1
    Which `openssl` package did you install? I believe you'll need the development package in order to build against it (part of the bundler build steps). Try `sudo apt-get install libssl-dev`, try again and update your question. :) – gertvdijk Aug 19 '14 at 12:34
  • I've installed it, but nothing changes! I'm aware of my newbieness, so probably there exists a simple way of solving this, but for the moment I'm stuck on this! The problem is likely to be in the way I'm upgrading Ruby, I think! Is there any specific command to rebuild Ruby? –  Aug 19 '14 at 12:49
  • Please **include in your question** all information on the Ruby specific changes you made to your system. The way Ruby is built may be very relevant to your issue now but we don't see that information currently. – gertvdijk Aug 19 '14 at 12:51
  • I've figured out how to solve the problem (with huge luck) by myself, I will answer to my own question, anyway thanks :-) I will provide as many details as possible! –  Aug 20 '14 at 16:08

2 Answers2

9

I've found the answer to my own question, and I think it would be more clear to post as an answer, rather than editing the question.

1st try. Let's go through the path of non-safe source link.

As pointed out here, a possible choice to bypass the openSSL check is to remove the safe https link and add the non-safe one:

gem source -r https://rubygems.org/
gem source -a http://rubygems.org/

This way, the installation seems to go fine, but somewhere around the process openSSL is required again (for nokogiri gem, if I remember it well).

2nd try. Rebuild Ruby (it was so easy).

By the time I asked this question, my brain was probably not working properly. After installing openSSL by the usual way:

sudo apt-get install openssl

I got to my ruby directory and typed the following lines:

pushd ext/openssl
ruby extconf.rb
make
make install
popd

This way, I had all dependencies issues and stuff solved (I guess). Then, running

./configure
make
make install

I've rebuilt Ruby and finally the installation went fine.

4

Rebuilding ruby after sudo apt-get install libssl-dev libreadline-dev libgdbm-dev can solve this issue.

The solution is found here: http://www.larshaendler.com/2015/05/20/unable-to-require-openssl-install-openssl-and-rebuild-ruby-on-ubuntu-14-lts/

techraf
  • 3,306
  • 10
  • 26
  • 37
Justus
  • 47
  • 1