Install OpenSSL Support for self-compiled Ruby Installation
I ran into the same problem. Turns out, the last line of the extconf.rb-generated Makefile reads
ossl.o: $(top_srcdir)/thread_native.h $(top_srcdir)/thread_$(THREAD_MODEL).h
However, top_srcdir
isn't defined anywhere in the Makefile.
I figured out where the missing header files were by running
sudo find / -name thread_native.h
which returned (approximately)
~/.rbenv/versions/2.1.0/thread_native.h
There's a line at the top that says something like
topdir = ~/.rbenv/versions/2.1.0/include/ruby-2.1.0
so I just added a line below it pointing to the directory from the find
:
top_srcdir = $(topdir)/../..
After all that, I did a make clean
in the ext/openssl
directory and then make
ran without the error.
Installing ruby-2.1.2: Cannot load such file -- openssl (LoadError)
Ruby <2.4 is incompatible with OpenSSL 1.1 (e.g see https://github.com/rbenv/ruby-build/issues/1353).
Just a hunch, but if you're using Mac + Homebrew, OpenSSL 1.0 was recently deleted, so anything along the lines of brew upgrade openssl
would trash that.
There are several options to deal with this:
- I have older Rubies via
asdf
installed with LibreSSL (which may be safer anyway, see https://security.stackexchange.com/questions/112545/what-are-the-main-advantages-of-using-libressl-in-favor-of-openssl):
$ openssl
OpenSSL> version
LibreSSL 2.8.3
- Compile and link your own OpenSSL 1.0 (or then set compiler flags as environment variables when building Ruby -- https://rvm.io/rubies/installing)
- See if your system's package manager allows you to access openssl 1.0 and install with that (was helping a coworker with this recently and we weren't able to find a good keg for homebrew at this time, unfortunately)
There might be something less convoluted than that; if someone has ideas, please feel free to comment or give an alternate answer.
EDIT
I personally ran into this issue with some other software and discovered that this fixed it, since the old SSL version was sitting around still:
brew switch openssl 1.0.2s
Should work so long as Homebrew doesn't "helpfully" clean that out for me.
Related Topics
Differencebetween Using .Exists, and .Present? in Ruby
How to Add Migration with Multiple References to the Same Model in One Table? Ruby/Rails
Using Custom To_JSON Method in Nested Objects
Running into Smtp Error When Trying to Send Email in Ror App
Portable Ruby on Rails Environment
How to Invoke an Instance Method on a Ruby Module Without Including It
Create Module Variables in Ruby
How to Calculate the Distance Between Two Gps Coordinates Without Using Google Maps API
Os X Mountain Lion: Gcc-4.2 No Such File or Directory
Error: Failed to Build Gem Native Extension When Installing Rails on MAC Mountian Lion Os
Installing Jekyll on Ubuntu 14.04
Why Many People Use "-%>" Instead of "%>" in Rails
Ruby on Rails Scalability/Performance