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

Created on 30 Jan 2016  路  22Comments  路  Source: rbenv/ruby-build

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.

unconfirmed

Most helpful comment

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.

All 22 comments

Thanks for sharing all this information. I can't reproduce using the same OS X version and latest "openssl" from Homebrew.

You don't need to link openssl from Homebrew in order to ruby-build to pick it up. It will be discovered automatically, even unlinked. You should unlink it to avoid messing up compilation of unrelated software.

@mislav : I unlinked and re-tried and I still get the same result:

~ 禄 brew unlink openssl --force
Unlinking /usr/local/Cellar/openssl/1.0.2f... 0 symlinks removed
~ 禄 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.20160130173044.22893
Results logged to /var/folders/6j/9f_77hx56nb7nthgbrwywwq4t55s8w/T/ruby-build.20160130173044.22893.log

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

+1

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 20160130)

Inspect or clean up the working tree at /var/folders/_8/zzmbwnb56zz2fqz3c66j2q740000gn/T/ruby-build.20160201134237.61009
Results logged to /var/folders/_8/zzmbwnb56zz2fqz3c66j2q740000gn/T/ruby-build.20160201134237.61009.log

Last 10 log lines:
    from /private/var/folders/_8/zzmbwnb56zz2fqz3c66j2q740000gn/T/ruby-build.20160201134237.61009/ruby-2.3.0/lib/fileutils.rb:225:in `block in mkdir_p'
    from /private/var/folders/_8/zzmbwnb56zz2fqz3c66j2q740000gn/T/ruby-build.20160201134237.61009/ruby-2.3.0/lib/fileutils.rb:211:in `each'
    from /private/var/folders/_8/zzmbwnb56zz2fqz3c66j2q740000gn/T/ruby-build.20160201134237.61009/ruby-2.3.0/lib/fileutils.rb:211:in `mkdir_p'
    from ./tool/rbinstall.rb:191:in `makedirs'
    from ./tool/rbinstall.rb:304:in `prepare'
    from ./tool/rbinstall.rb:513:in `block in <main>'
    from ./tool/rbinstall.rb:801:in `block in <main>'
    from ./tool/rbinstall.rb:798:in `each'
    from ./tool/rbinstall.rb:798:in `<main>'
make: *** [do-install-all] Error 1

Fixed by exiting git sh (my shell), then running rbenv install 2.3.0

@ryan-sherpa: I use ZSH so I tried to run rbenv install 2.3.0 in BASH. Same thing happens:

Workspace/supporter [bd-charity-projection-lifecycle] 禄 /bin/bash
bash-3.2$ 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 20160130)

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

Last 10 log lines:
compiling ifaddr.c
installing tcltklib libraries
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

Also, ran from user root directory. Not sure that should make a difference.

It looks like we had 2 different errors, propagating the same BUILD FAILED error message.

It is still weird that changing your shell changed the behaviour of the rbenv install command

@mislav if the recommandation from the error message is

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

is there anything I should delete on my machine before re-trying? Or is it most likely a tag/flags error?

UPDATE
I tried to install 2.2.4 and it turns out this is a general failure. I can't install it.
the log indicates that it would come from ossl_ssl.c:

compiling syslog.c
compiling ossl_ssl.c
linking shared-object syslog.bundle
installing default syslog libraries
compiling raddrinfo.c
ossl_ssl.c:125:5: error: use of undeclared identifier 'TLSv1_2_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_2_method
^
ossl_ssl.c:126:5: error: use of undeclared identifier 'TLSv1_2_server_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2_server),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_2_server_method
^
ossl_ssl.c:127:5: error: use of undeclared identifier 'TLSv1_2_client_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_2_client),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_2_client_method
^
ossl_ssl.c:131:5: error: use of undeclared identifier 'TLSv1_1_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_1_method
^
ossl_ssl.c:132:5: error: use of undeclared identifier 'TLSv1_1_server_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1_server),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_1_server_method
^
ossl_ssl.c:133:5: error: use of undeclared identifier 'TLSv1_1_client_method'
    OSSL_SSL_METHOD_ENTRY(TLSv1_1_client),
    ^
ossl_ssl.c:119:69: note: expanded from macro 'OSSL_SSL_METHOD_ENTRY'
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                    ^
<scratch space>:162:1: note: expanded from here
TLSv1_1_client_method
^
ossl_ssl.c:213:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:115:14) []'
    for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
                                  ^~~~~
ossl_ssl.c:1149:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
            if (rc = SSL_shutdown(ssl))
                ~~~^~~~~~~~~~~~~~~~~~~
ossl_ssl.c:1149:13: note: place parentheses around the assignment to silence this warning
            if (rc = SSL_shutdown(ssl))
                   ^
                (                     )
ossl_ssl.c:1149:13: note: use '==' to turn this assignment into an equality comparison
            if (rc = SSL_shutdown(ssl))
                   ^
                   ==
ossl_ssl.c:2216:23: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:115:14) []'
    ary = rb_ary_new2(numberof(ossl_ssl_method_tab));
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
                                  ^~~~~
ossl_ssl.c:2217:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:115:14) []'
    for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
                                  ^~~~~

So that makes me think of an incompatibility with the current openssl version.
Since I am running openssl: stable 1.0.2f (bottled) [keg-only]and the latest release of ruby-build, this does not make sense to me. Only thing I can thing of is a LDFLAGS or CPPFLAGS issue.
What do you think @mislav ?

There were definitely multiple reports of this, but I haven't been able to reproduce and don't know what's going on. On the surface it looks like Ruby might not be compatible with newer versions of OpenSSL, which in theory could definitely be true since it happened before, but in this case it doesn't seem true since I cannot reproduce on OS X with same combination of Ruby + OpenSSL versions.

@mislav I was able to install 2.1.8 with no issue. Then I tried to install 2.2.0.

So maybe it comes from ruby 2.2.X

I uninstalled openssl using brew and re-ran rbenv install 2.3.0. After rbenv installed openssl openssl-1.0.2f the install failed again. I really don't know where else to look.

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

Since linking openssl could have unwanted side effects, I'd call this issue hacked-around rather than closed, myself.

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.

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.

@ljohnston You just saved my bacon. nicely spotted. cheers

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.

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.

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

Just in case someone is having this issue and all of the above didn't help:

I discovered that I had macports installed along with homebrew. That was causing weird openssl intermingling.

I removed macports and cleaned up all its directories. After that, rbenv install 2.3.3 install successfully. Good luck!

Note: be sure you know what you're doing before removing macports. You may have some important dependencies.

moving /usr/local/Cellar/openssl098/ and /usr/local/Cellar/openssl1.1 to tmp and then reinstalling with brew install openssl worked for me! (ruby 2.3.2 El Capitan with rvm) Thanks henrik

Was this page helpful?
0 / 5 - 0 ratings