ruby-build icon indicating copy to clipboard operation
ruby-build copied to clipboard

The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

Open nathany opened this issue 13 years ago • 85 comments

rbenv install 2.0.0-p247 fails on Mac OS X 10.8.4 with the error:

The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

I had no problem installing 1.9.3-p448.

Using ruby-build 20130628 via Homebrew.

nathany avatar Jun 28 '13 17:06 nathany

@nathany I had this issue too, but it's working for me now. There were 2 things I did to try to fix it:

  • Update to the latest ruby-build. But, it looks like you already have that.
  • Install the rbenv ruby-build plugin into ~/.rbenv/plugins/. Curiously,I didn't have it in that plugin dir before, but still had the rbenv install command available. Maybe rbenv has some built-in install command that's older than the latest plugin, or maybe I had previously installed something somewhere else that it was picking up -- I'm not sure. Either way, getting the latest version of the plugin in that directory seemed to help.

kelan avatar Jun 29 '13 21:06 kelan

@kelan That's odd. I don't have a ~/.rbenv/plugins/ at all, as I installed/updated both rbenv/ruby-build via Homebrew.

nathany avatar Jun 29 '13 22:06 nathany

@nathany That's my point. It didn't work when I didn't have the plugin installed, but did after I installed it (as suggested on the ruby-build plugin page) by doing:

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

So, try that and see if it helps.

kelan avatar Jun 29 '13 22:06 kelan

@kelan Thanks for the tip. Since I'm not needing Ruby 2.0 for a few days, I'm going to wait-and-see if the Installing with Homebrew option is made to work. If not, then I'll try the method you described.

nathany avatar Jun 29 '13 22:06 nathany

This is what I'm seeing:

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Cloning into '/Users/joe/.rbenv/plugins/ruby-build'...
remote: Counting objects: 1947, done.
remote: Compressing objects: 100% (1172/1172), done.
remote: Total 1947 (delta 783), reused 1727 (delta 592)
Receiving objects: 100% (1947/1947), 267.44 KiB, done.
Resolving deltas: 100% (783/783), done.


$ ~/.rbenv/plugins/ruby-build/bin/ruby-build 2.0.0-p195 2.0.0-p195
Downloading openssl-1.0.1e.tar.gz...
-> https://www.openssl.org/source/openssl-1.0.1e.tar.gz
Installing openssl-1.0.1e...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/q7/ywcv_w057m1cmpgpjkcl69ym0000gn/T/ruby-build.20130701095203.18386
Results logged to /var/folders/q7/ywcv_w057m1cmpgpjkcl69ym0000gn/T/ruby-build.20130701095203.18386.log

Last 10 log lines:
cp: 2.0.0-p195/openssl/include/openssl/opensslconf.h: No such file or directory
chmod: 2.0.0-p195/openssl/include/openssl/opensslconf.h: No such file or directory
cp: 2.0.0-p195/openssl/include/openssl/ebcdic.h: No such file or directory
chmod: 2.0.0-p195/openssl/include/openssl/ebcdic.h: No such file or directory
cp: 2.0.0-p195/openssl/include/openssl/symhacks.h: No such file or directory
chmod: 2.0.0-p195/openssl/include/openssl/symhacks.h: No such file or directory
cp: 2.0.0-p195/openssl/include/openssl/ossl_typ.h: No such file or directory
chmod: 2.0.0-p195/openssl/include/openssl/ossl_typ.h: No such file or directory
make[1]: *** [install] Error 1
make: *** [install_sw] Error 1

joevandyk avatar Jul 01 '13 17:07 joevandyk

Very weird. The above (running ruby-build directly) failed, but this works: rbenv install 2.0.0-p195

joevandyk avatar Jul 01 '13 17:07 joevandyk

@joevandyk Yeah, I wouldn't image that rbenv plugin would affect calling ruby-build directly. When I said "it worked for me", I mean using rbenv install XXX, which also worked for you. So that's good.

That said, I'm not sure why ruby-build directly doesn't work directly. Looks like it's an openssl dependency issue, which maybe the rbenv plugin takes care of for you?

kelan avatar Jul 01 '13 20:07 kelan

My guess is that rbenv install XXX sets up the environment/paths differently (and correctly) than calling ruby-build directly when installing openssl.

joevandyk avatar Jul 01 '13 20:07 joevandyk

I just updated ruby-build again and tried rbenv install 2.0.0-p247 and still got error on SSL. I have already installed several other versions of ruby without error:

Versions installed

$ rbenv versions
* system (set by /Users/loeffler/.ruby-version)
  1.9.3-p327
  1.9.3-p429
  1.9.3-p448
  2.0.0-p195

Error message:

$ rbenv install 2.0.0-p247
Downloading ruby-2.0.0-p247.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
Installing ruby-2.0.0-p247...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/f5/7ch_20911gs9632m4nnk_0m00000gn/T/ruby-build.20130702220834.25051
Results logged to /var/folders/f5/7ch_20911gs9632m4nnk_0m00000gn/T/ruby-build.20130702220834.25051.log

Last 10 log lines:
installing default gems:      /Users/loeffler/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                          bigdecimal 1.2.0
                          io-console 0.4.2
                          json 1.7.7
                          minitest 4.3.2
                          psych 2.0.0
                          rake 0.9.6
                          rdoc 4.0.0
                          test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

perfectionist avatar Jul 03 '13 03:07 perfectionist

@perfectionist Same experience here. Did you use homebrew to install both rbenv and ruby-build?

nathany avatar Jul 04 '13 16:07 nathany

I did not use homebrew at all. I had installed it once but was having issues so I uninstalled it several months ago. That was no easy task.

I am wondering if the file ~/.rbenv/plugins/ruby-build/share/ruby-build/2.0.0-p247 should have a different version of openssl.

perfectionist avatar Jul 04 '13 16:07 perfectionist

To install rbenv and ruby-install I used git.

perfectionist avatar Jul 04 '13 17:07 perfectionist

Good question. p247 appears to use the same version as p195, and the later installs fine.

nathany avatar Jul 04 '13 17:07 nathany

Trying rbenv for the first time. Running into the same problem with openssl missing.

I tried rbenv install ruby-2.0.0-p247 and received the The Ruby openssl extension was not compiled. Missing the OpenSSL lib? message.

openssl was already on the system with macports. I also installed it with homebrew. No avail.

CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl" rbenv install 2.0.0-p247 did not solve the problem.

However, CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=brew --prefix opensslrbenv install 2.0.0-p247

did solve the problem.

danielb2 avatar Jul 05 '13 21:07 danielb2

@danielb2 I got the same error with CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1e rbenv install 2.0.0-p247

nathany avatar Jul 14 '13 18:07 nathany

Copying this from my comment here:

Not sure about the Mac users, but I had this issue on my new Debian virtual machine and was perplexed as to why it was occurring when I had openssl installed. I researched a little bit, and eventually wound up with the solution of installing the development ssl library. This is what I did:

# apt-get install libssl-dev
$ rbenv install ruby-2.0.0-p247
Downloading ruby-2.0.0-p247.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
Installing ruby-2.0.0-p247...
Installed ruby-2.0.0-p247 to /home/joshua/.rbenv/versions/2.0.0-p247

I assume you can do the same thing with brew but I don't know for sure. Hope this helps!

jo-sm avatar Jul 15 '13 18:07 jo-sm

This did the trick (unbelievably, I hadn't installed openssl via brew, though every other version of Ruby installed fine):

brew install openssl
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1e rbenv install 2.0.0-p247

nathany avatar Jul 16 '13 00:07 nathany

Explicitly specifying openssl did the trick for me. Thanks @nathany

MiguelMadero avatar Jul 26 '13 17:07 MiguelMadero

Thanks for this. Was having the same issue, but adding the options to the command worked great. Odd.

cfurrow avatar Aug 01 '13 21:08 cfurrow

Attempting to install Ruby 2.0.0-p247 with rbenv and getting the same issue. I have openssl installed via brew and I'm specifying it in the 'rbenv install' command like @nathany suggests. Still get the same error.

scottmagdalein avatar Aug 02 '13 19:08 scottmagdalein