ruby-build: Can't build 2.3.0 on El Capitan

I am running into a build error when I want to rbenv install 2.3.0 :

~ » rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...

BUILD FAILED (OS X 10.11.3 using ruby-build 20160111)

Inspect or clean up the working tree at /var/folders/6j/9f_77hx56nb7nthgbrwywwq4t55s8w/T/ruby-build.20160130145501.97544
Results logged to /var/folders/6j/9f_77hx56nb7nthgbrwywwq4t55s8w/T/ruby-build.20160130145501.97544.log

Last 10 log lines:
installing tcltklib libraries
compiling ifaddr.c
installing default socket libraries
compiling init.c
compiling constants.c
linking shared-object socket.bundle
linking shared-object tcltklib.bundle
installing default tcltklib libraries
linking shared-object ripper.bundle
make: *** [build-ext] Error 2

I am running :

  • Homebrew 0.9.5 (git revision 7ff2f; last commit 2016-01-29)
  • rbenv 1.0.0
  • ruby-build 20160111
  • openssl: stable 1.0.2f (bottled) [keg-only]

this is where things seem to go down in the log file:

ossl_ssl.c:95:5: error: use of undeclared identifier 'TLSv1_2_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_2_method
^
ossl_ssl.c:96:5: error: use of undeclared identifier 'TLSv1_2_server_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2_server),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_2_server_method
^
ossl_ssl.c:97:5: error: use of undeclared identifier 'TLSv1_2_client_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2_client),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_2_client_method
^
ossl_ssl.c:101:5: error: use of undeclared identifier 'TLSv1_1_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_1_method
^
installing default syslog libraries
ossl_ssl.c:102:5: error: use of undeclared identifier 'TLSv1_1_server_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1_server),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_1_server_method
^
ossl_ssl.c:103:5: error: use of undeclared identifier 'TLSv1_1_client_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1_client),
    ^
ossl_ssl.c:89:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:176:1: note: expanded from here
TLSv1_1_client_method
^
ossl_ssl.c:186:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:85:14) []'
    for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:18:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
                                  ^~~~~
compiling option.c
ossl_ssl.c:812:18: warning: implicit declaration of function 'ssl_encode_npn_protocols' is invalid in C99 [-Wimplicit-function-declaration]
        VALUE rprotos = ssl_encode_npn_protocols(val);
                        ^
ossl_ssl.c:813:2: warning: implicit declaration of function 'SSL_CTX_set_alpn_protos' is invalid in C99 [-Wimplicit-function-declaration]
        SSL_CTX_set_alpn_protos(ctx, (const unsigned char *)StringValueCStr(rprotos), RSTRING_LENINT(rprotos));
        ^
ossl_ssl.c:817:2: warning: implicit declaration of function 'SSL_CTX_set_alpn_select_cb' is invalid in C99 [-Wimplicit-function-declaration]
        SSL_CTX_set_alpn_select_cb(ctx, ssl_alpn_select_cb, (void *) self);
        ^
ossl_ssl.c:817:34: error: use of undeclared identifier 'ssl_alpn_select_cb'
        SSL_CTX_set_alpn_select_cb(ctx, ssl_alpn_select_cb, (void *) self);
                                        ^
compiling ossl_ssl_session.c
ossl_ssl.c:1906:5: warning: implicit declaration of function 'SSL_get0_alpn_selected' is invalid in C99 [-Wimplicit-function-declaration]
    SSL_get0_alpn_selected(ssl, &out, &outlen);
    ^
ossl_ssl.c:2265:23: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:85:14) []'
    ary = rb_ary_new2(numberof(ossl_ssl_method_tab));
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:18:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
                                  ^~~~~
ossl_ssl.c:2266:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:85:14) []'
    for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:18:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))

things I have tried so far

  • installing 2.3.0-dev fails the same way
  • un-linking/re-linking openssl did no improve it either
  • reinstalling openssl doesn’t improve it

This possibly relates to #889 but maybe not.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (2 by maintainers)

Most upvoted comments

I just fought with this issue for the last couple of hours. In my case, although I had done a brew uninstall openssl and brew install openssl to ensure I had the latest openssl version, it turns out that I had at some point installed openssl098. So a simple brew uninstall openssl098 fixed the issue for me.

@mislav Last update: I uninstalled openssl on my mac.then I reinstalled it. then I force-linked it with brew link --overwrite openssl --force

And I could install 2.3.0

You can close the issue since you are the owner, but I can do it if you want.

I was unable to run brew uninstall openssl098: I got ‘Error: No available formula with the name “openssl098”’.

I did see it in brew list, though.

I ended up getting rid of it like this instead: mv /usr/local/Cellar/openssl098/ /tmp (Stored it in tmp just in case there would be issues.)

So far, so good. Was finally able to compile Ruby 2.3.3 on my macOS Sierra.

Thank you very much, @ljohnston . That worked for me too. After uninstalling openssl098, I was able to successfully reinstall Ruby 2.3 with openssl unlinked.

Had the same problem with two installed versions of openssl, 1.0.2g and 1.0.2j. Uninstalled all versions of openssl, re-installed the latest and installed Ruby v2.3.1 via

brew uninstall --force openssl
brew install openssl
rbenv install 2.3.1

Thank you all.

@henrik you just saved my macbook’s life. I was on the verge of smashing it against a wall out of frustration. Moving that openssl098 folder to /tmp allowed me to install ruby 2.3.3 without the crazy openssl error that I was getting for the past two days (fortunately I didn’t spend the whole time of those two days banging my head against it).

But this definitely fixed it. Thanks!