Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nathany opened this issue Jun 28, 2013 · 85 comments
Closed

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

nathany opened this issue Jun 28, 2013 · 85 comments

Comments

@nathany
Copy link

nathany commented Jun 28, 2013

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.

@kelan
Copy link

kelan commented Jun 29, 2013

@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.

@nathany
Copy link
Author

nathany commented Jun 29, 2013

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

@kelan
Copy link

kelan commented Jun 29, 2013

@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.

@nathany
Copy link
Author

nathany commented Jun 29, 2013

@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.

@joevandyk
Copy link

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
Copy link

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

@kelan
Copy link

kelan commented Jul 1, 2013

@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?

@joevandyk
Copy link

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

@perfectionist
Copy link

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?

@nathany
Copy link
Author

nathany commented Jul 4, 2013

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

@perfectionist
Copy link

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
Copy link

To install rbenv and ruby-install I used git.

@nathany
Copy link
Author

nathany commented Jul 4, 2013

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

@danielb2
Copy link

danielb2 commented Jul 5, 2013

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.

@nathany
Copy link
Author

nathany commented Jul 14, 2013

@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

@jo-sm
Copy link

jo-sm commented Jul 15, 2013

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!

@nathany
Copy link
Author

nathany commented Jul 16, 2013

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

@MiguelMadero
Copy link

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

@cfurrow
Copy link

cfurrow commented Aug 1, 2013

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

@scottmagdalein
Copy link

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.

@cfurrow
Copy link

cfurrow commented Aug 2, 2013

@scottmagdalein I haven't tried p247 yet, I was installing p195 at the time. Does that work for you?

@MiguelMadero
Copy link

it worked for me for 247

miguel
On Aug 2, 2013 1:00 PM, "Carl Furrow" notifications@github.com wrote:

@scottmagdalein https://github.com/scottmagdalein I haven't tried p247
yet, I was installing p195 at the time. Does that work for you?


Reply to this email directly or view it on GitHubhttps://github.com//issues/377#issuecomment-22031338
.

@scottmagdalein
Copy link

@cfurrow That doesn't work either. Same error.

Full error:

$ RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1e rbenv install 2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz
Installing ruby-2.0.0-p195...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/v1/f8v8hqk12cdcdjwp660mz8fm0000gp/T/ruby-build.20130802163339.47002
Results logged to /var/folders/v1/f8v8hqk12cdcdjwp660mz8fm0000gp/T/ruby-build.20130802163339.47002.log

Last 10 log lines:
installing default gems:      /Users/scottmagdalein1/.rbenv/versions/2.0.0-p195/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?`

@mjstrasser
Copy link

I am having the same problem on OS X 10.7.5. I installed rbenv, ruby-build and openssl using Homebrew and removed (hopefully) all vestiges of rvm and MacPorts. I have set the environment variable RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1e and got the following outcomes:

  • rbenv install 1.9.3-p448 succeeds
  • rbenv install 2.0.0-p247 fails with the Missing the OpenSSL lib? error message
  • rbenv install 2.0.0-p195 fails with the Missing the OpenSSL lib? error message

@mjstrasser
Copy link

I have now succeeded in installing Ruby 2.0.0-p247 on OS X using rbenv install (i.e. ruby-build).

I found references to a library under /Users/mike/.rvm. The reference was in the file /usr/local/Cellar/openssl/1.0.1e/include/openssl/opensslconf.h so I must have installed this version using Homebrew before deleting RVM (or something). So I uninstalled and reinstalled OpenSSL via Homebrew:

brew uninstall openssl
brew install openssl

After that, rbenv install 2.0.0-p247 succeeded. There was no need to set RUBY_CONFIGURE_OPTS in the environment. I think ruby-build checks for the Homebrew version on OS X and sets the option for you.

@scottmagdalein
Copy link

Thanks for commenting here and reminding me that I need to update as well.

I got Ruby 2.0.0-p247 installed, finally, after brew uninstall openssl and then brew install openssl to clean and reinstall it. Apparently, when I ran brew install openssl the first time when I started the 2.0 install process with rbenv, it didn't get done right even though brew was telling me it was up to date (1.0.1e).

@runk
Copy link

runk commented Aug 12, 2013

Got the same issue, RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local/ rbenv install 2.0.0-p247 did a trick for me.

@troyharvey
Copy link

Thanks @nathany, this worked for me.

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

@brownmike
Copy link

Ditto:

Thanks @nathany, this worked for me.

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

@MiguelMadero
Copy link

This might help
https://coderwall.com/p/n9bnug

Summary:

brew link openssl --force

@Krylon360
Copy link

for CentOS 6.4; if you've installed the openssl-1.0.1e.el6_5 rpm, ftp://ftp.pbone.net/mirror/ftp.centos.org/6.5/updates/x86_64/Packages/openssl-1.0.1e-16.el6_5.4.0.1.centos.x86_64.rpm. I had to install this package due to a dependency from another project I'm working on. When Ruby; or ruby-build/install would attempt to resolve the openssl-devel by yum installing it; it would error. You will need the openssl-devel package as well.
sudo yum install -y ftp://ftp.pbone.net/mirror/ftp.centos.org/6.5/updates/x86_64/Packages/openssl-devel-1.0.1e-16.el6_5.4.0.1.centos.x86_64.rpm

Once I was able to get the correct devel package installed; @CoreyCole's directions worked just fine!

@florianb
Copy link

@mislav I'd like to suggest a check based upon ldconfig -p | grep libssl as it is mentioned on this serverfault post.

If appreciated i'd like trying to create a pull-request for that issue.

@mislav
Copy link
Member

mislav commented Jan 26, 2015

@florianb That's a start, except it doesn't work on OS X.

Pull requests welcome of course.

@defaye
Copy link

defaye commented May 14, 2015

sudo apt-get install libssl-dev works on ubuntu 15.04 👍

@mingliangfeng
Copy link

Some basic libs are required, recommend this:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

@andreynering
Copy link

I had problems trying to install Ruby 2.2.2 on Fedora 22, but the following worked for me:

dnf install openssl-devel
rbenv install 2.2.2
rbenv global 2.2.2

@charneykaye
Copy link

Ubuntu 14:

sudo apt-get install libssl-dev

@emckenna
Copy link

patch worked for me when installing 2.2.2 and 2.2.3 on Arch using openssl 1.0.2.g-3

@hugobast
Copy link

I'm sorry to say this but on macOS 10.12 with latest ruby-build this is still an issue. I brew installed openssl and I still have a hell of a time in making it play nice with rbenv install.

It's really unfortunate but this:

CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`"

... worked ...

@PascalPixel
Copy link

macOS 10.13 High Sierra Beta 2
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.3.4
Thank you @hugobast

@menjilx
Copy link

menjilx commented Jul 3, 2017

@hugobast

Will try your solution as well, I encountered same error during installation as well.

And It works! ;) Thanks.

@dubcl
Copy link

dubcl commented Sep 11, 2017

Hi, for Debian Stretch and ruby 2.2.3 install:

apt-get install libssl1.0-dev

not libssl-dev, then apply this:

#834 (comment)

@andersonmills
Copy link

For macports, this worked for me...

RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/local/" rbenv install 2.4.1

@bg-scro
Copy link

bg-scro commented Jan 6, 2018

git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build worked for me!

Followed that with rbenv install 2.4.0 and everything is hunky-dory.

@zackkenyon
Copy link

when I installed rbenv through brew, I got this message

This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

have you tried adding these flags to rbenv install?

@gregorvand
Copy link

using RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/[latest version] rbenv install [version] worked for me finally..

jfmyers9 added a commit to cloudfoundry/bosh-linux-stemcell-builder that referenced this issue Jun 12, 2018
New centos-7 stemcell can't properly link OpenSSL lib when compiling
ruby-2.4-r4.
More details at rbenv/ruby-build#377 (comment)

[#158227319](https://www.pivotaltracker.com/story/show/158227319)

Co-authored-by: James Myers <jmyers@pivotal.io>
@wmpeng
Copy link

wmpeng commented Oct 12, 2019

using RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/[latest version] rbenv install [version] worked for me finally..

Works for me. macOS 10.14.6

@TorvaldsDB
Copy link

TorvaldsDB commented Nov 5, 2019

using RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/[latest version] rbenv install [version] worked for me finally..

First, thank you so much. I failed at the beginning because I copied the commands above guys' . You help me out of the trouble.

Here the exactly what we should do:

# look into your real openssl version, as for me is `1.0.2s`
ls /usr/local/Cellar/openssl/
# then to confirm the ruby version you need, as for me is `2.3.3`
# implement the command
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s rbenv install 2.3.3

God bless you.

@garydamm
Copy link

I was having this issue with OSX 10.15.3. The version of openssl that homebrew installed was 1.1 and I was trying to install ruby 2.3.8, which did not work.

I eventually got it to work using openssl version 1.0.2.

RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2 rbenv install 2.3.8

@MilanVilov
Copy link

I had this issue and official rbenv documentation as well as installation of a new version of ruby (2.7.1) solved it.
https://github.com/rbenv/ruby-build/wiki#updating-ruby-build

@rbenv rbenv locked and limited conversation to collaborators Dec 29, 2021
@hsbt hsbt converted this issue into discussion #1882 Dec 29, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests