It appears that something is causing the 2.4.1 build not to find the copy of OpenSSL (1.1.0e) that ruby-build has just installed in ~/.rbenv/versions/2.4.1/openssl/. When I run rbenv install 2.4.1, I get:
BUILD FAILED (OS X 10.12.4 using ruby-build 20170405-6-gc7a4f34)
Some of the relevant output:
Downloading openssl-1.1.0e.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/57be8618979d80c910728cfc99369bf97b2a1abd8f366ab6ebdee8975ad3874c
Installing openssl-1.1.0e...
Installed openssl-1.1.0e to /Users/kbullock/.rbenv/versions/2.4.1
[...]
Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.
Configure options used:
--prefix=/Users/kbullock/.rbenv/versions/2.4.1
--with-openssl-dir=/Users/kbullock/.rbenv/versions/2.4.1/openssl
CC=clang
LDFLAGS=-L/Users/kbullock/.rbenv/versions/2.4.1/lib
CPPFLAGS=-I/Users/kbullock/.rbenv/versions/2.4.1/include
In the log, I see:
*** Following extensions failed to configure:
../.././ext/gdbm/extconf.rb:0: Failed to configure gdbm. It will not be installed.
../.././ext/openssl/extconf.rb:64: Ignore OpenSSL broken by Apple.
../.././ext/openssl/extconf.rb:64: Please use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')
*** Fix the problems, then remove these directories and try again if you want.
...which is confusing given that the build script claims it _is_ passing --with-openssl-dir.
I'm seeing exactly the same problem. I recently upgraded to Sierra, and am installing rbenv for sass, as the upgrade trashed my previous gems and I've decided to avoid using the system ruby from now on.
Other than some html build errors, the only thing I can see which might be a problem are these libraries with "no symbols" - are these errors? Does this mean these object files are empty?
created directory `/Users/pipjones/.rbenv/versions/2.4.1/openssl/lib'
install libcrypto.a -> /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(async_null.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(async_win.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(dso_dl.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(dso_openssl.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(dso_vms.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(dso_win32.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(ebcdic.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(ecp_nistp224.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(ecp_nistp256.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(ecp_nistp521.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(ecp_nistputil.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(e_rc5.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(m_md2.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(rand_egd.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(rand_vms.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(rand_win.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(threads_none.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.a.new(threads_win.o) has no symbols
install libssl.a -> /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libssl.a
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libssl.a.new(ssl_utst.o) has no symbols
ranlib: file: /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libssl.a.new(t1_trce.o) has no symbols
install libcrypto.1.1.dylib -> /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.1.1.dylib
link /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.dylib -> /Users/pipjones/.rbenv/versions/2.4.1/openssl/lib/libcrypto.1.1.dylib
Then similarly to the above comment.
compiling zlib.c
linking shared-object zlib.bundle
*** Following extensions failed to configure:
../.././ext/gdbm/extconf.rb:0: Failed to configure gdbm. It will not be installed.
../.././ext/openssl/extconf.rb:64: Ignore OpenSSL broken by Apple.
../.././ext/openssl/extconf.rb:64: Please use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')
*** Fix the problems, then remove these directories and try again if you want.
linking ruby
Generating RDoc documentation
Parsing sources...
0% [ 1/889] ...440000gn/T/ruby-build.20170707130024.92585/ruby-2.4.1/doc/ChangeLog-0.06_to_0.52
0% [ 2/889] ...440000gn/T/ruby-build.20170707130024.92585/ruby-2.4.1/doc/ChangeLog-0.50_to_0.60
...
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
generating enc.mk
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
generating makefile exts.mk
*** Following extensions failed to configure:
../.././ext/gdbm/extconf.rb:0: Failed to configure gdbm. It will not be installed.
../.././ext/openssl/extconf.rb:0: Failed to configure openssl. It will not be installed.
*** Fix the problems, then remove these directories and try again if you want.
make[2]: `ruby' is up to date.
making enc
make[1]: Nothing to be done for `enc'.
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
make[1]: Nothing to be done for `encs'.
Generating RDoc documentation
...
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/pipjones/.rbenv/versions/2.4.1
--with-openssl-dir=/Users/pipjones/.rbenv/versions/2.4.1/openssl
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/pipjones/.rbenv/versions/2.4.1/lib
CPPFLAGS=-I/Users/pipjones/.rbenv/versions/2.4.1/include
By the end of the build the entire ~/.rbenv/versions/2.4.1/ is gone, but I did have a poke around during the build process and the ssl installation looked OK.
It is like you say, it installs it but then can't find it, or is ignoring the option path and finding the default "broken apple" version and ignoring it. My only thought was if those libs are empty from the "no symbols" warning - perhaps it detects the built version as similarly broken?
I worked around this (as have many other people) by setting the path in the environment.
I have MacPorts SSL so this path locates the installed lib:
$ RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local/
I know this doesn't "fix" the problem in the build, but thought I'd share it as a workaround
See https://github.com/rbenv/ruby-build/wiki for more examples of similar problems and solutions.
This is still an issue on 10.12.6 building Ruby 2.4.2.
After some further investigation, I believe this is happening in the presence of a pkg-config command installed by something other than the base system. In my case, this came from Fink, but I expect the same would happen if you'd gotten pkg-config from Homebrew or MacPorts. In Ruby 2.4, ext/openssl/extconf.rb has:
result = pkg_config("openssl") && have_header("openssl/ssl.h")
# ...
unless result
unless find_openssl_library
Logging::message "=== Checking for required stuff failed. ===\n"
Logging::message "Makefile wasn't created. Fix the errors above.\n"
exit 1
end
end
where find_openssl_library is a fallback that uses have_library and friends from mkmf to locate OpenSSL if pkg_config fails to.
One possible fix for this would be to set PKG_CONFIG_PATH to the OpenSSL directory that ruby-build creates. I think this would still work if pkg-config isn't present, because it'll just fall back to looking in the normal system paths for the library. Does this sound reasonable? If so I'll put in a pull request for it.
Confirming that @krbullock's pull request above did resolve this issue for me of installing ruby 2.4.2 using rbenv (1.1.1), running on macOS 10.12.6.
Based on @krbullock鈥檚 comment, I removed /opt/local/bin and /opt/local/sbin from my PATH (these are MacPort鈥檚 bin directories) and then rbenv install 2.4.2 succeeded. I鈥檓 using rbenv 1.1.1 on macOS 10.12.6.
I had this issue installing 2.4.2. This solution worked for me: https://github.com/rbenv/rbenv/issues/1042#issuecomment-334090748
macOS 10.12.x is EOL now. Unfortunately, We couldn't fix it with macOS 10.12.x now.
Most helpful comment
I worked around this (as have many other people) by setting the path in the environment.
I have MacPorts SSL so this path locates the installed lib:
$ RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local/
I know this doesn't "fix" the problem in the build, but thought I'd share it as a workaround
See https://github.com/rbenv/ruby-build/wiki for more examples of similar problems and solutions.