ruby-build: Ruby 2.5.0-preview1 fails to build on macOS 10.13 High Sierra

$ xcode-select -p

/Applications/Xcode.app/Contents/Developer
$ gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin17.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ rbenv install 2.5.0-preview1

Downloading openssl-1.1.0f.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/12f746f3f2493b2f39da7ecf63d7ee19c6ac9ec6a4fcd8c229da8a522cb12765
Installing openssl-1.1.0f...
Installed openssl-1.1.0f to /Users/username/.rbenv/versions/2.5.0-preview1

Downloading ruby-2.5.0-preview1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0-preview1.tar.bz2
Installing ruby-2.5.0-preview1...

BUILD FAILED (OS X 10.13 using ruby-build 20170914-5-gf41e847)

Inspect or clean up the working tree at /var/folders/k0/txdvcgj145v2d3lb358bnkkr0000gn/T/ruby-build.20171013221528.17242
Results logged to /var/folders/k0/txdvcgj145v2d3lb358bnkkr0000gn/T/ruby-build.20171013221528.17242.log

Last 10 log lines:
    X509_REQ_get0_signature(req, NULL, &alg);
    ^
5 warnings generated.
4 warnings generated.
1 warning generated.
8 warnings generated.
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
ossl_x509cert.c:87:5: warning: implicit declaration of function 'X509_up_ref' is invalid in C99 [-Wimplicit-function-declaration]
    X509_up_ref(x509);
    ^
ossl_x509cert.c:334:31: warning: implicit declaration of function 'X509_get0_tbs_sigalg' is invalid in C99 [-Wimplicit-function-declaration]
    if (!i2a_ASN1_OBJECT(out, X509_get0_tbs_sigalg(x509)->algorithm)) {
                              ^
ossl_x509cert.c:334:59: error: member reference type 'int' is not a pointer
    if (!i2a_ASN1_OBJECT(out, X509_get0_tbs_sigalg(x509)->algorithm)) {
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
ossl_x509cert.c:424:22: warning: implicit declaration of function 'X509_get0_notBefore' is invalid in C99 [-Wimplicit-function-declaration]
    if (!(asn1time = X509_get0_notBefore(x509))) {
                     ^
ossl_x509cert.c:424:20: warning: incompatible integer to pointer conversion assigning to 'const ASN1_TIME *' (aka 'const struct asn1_string_st *') from 'int' [-Wint-conversion]
    if (!(asn1time = X509_get0_notBefore(x509))) {
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_x509cert.c:463:22: warning: implicit declaration of function 'X509_get0_notAfter' is invalid in C99 [-Wimplicit-function-declaration]
    if (!(asn1time = X509_get0_notAfter(x509))) {
                     ^
ossl_x509cert.c:463:20: warning: incompatible integer to pointer conversion assigning to 'const ASN1_TIME *' (aka 'const struct asn1_string_st *') from 'int' [-Wint-conversion]
    if (!(asn1time = X509_get0_notAfter(x509))) {
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings and 1 error generated.
make[2]: *** [ossl_x509cert.o] Error 1
make[2]: *** Waiting for unfinished jobs....
ossl_x509crl.c:175:5: warning: implicit declaration of function 'X509_CRL_get0_signature' is invalid in C99 [-Wimplicit-function-declaration]
    X509_CRL_get0_signature(crl, NULL, &alg);
    ^
ossl_x509crl.c:214:12: warning: implicit declaration of function 'X509_CRL_get0_lastUpdate' is invalid in C99 [-Wimplicit-function-declaration]
    time = X509_CRL_get0_lastUpdate(crl);
           ^
ossl_x509crl.c:214:10: warning: incompatible integer to pointer conversion assigning to 'const ASN1_TIME *' (aka 'const struct asn1_string_st *') from 'int' [-Wint-conversion]
    time = X509_CRL_get0_lastUpdate(crl);
         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_x509crl.c:245:12: warning: implicit declaration of function 'X509_CRL_get0_nextUpdate' is invalid in C99 [-Wimplicit-function-declaration]
    time = X509_CRL_get0_nextUpdate(crl);
           ^
ossl_x509crl.c:245:10: warning: incompatible integer to pointer conversion assigning to 'const ASN1_TIME *' (aka 'const struct asn1_string_st *') from 'int' [-Wint-conversion]
    time = X509_CRL_get0_nextUpdate(crl);
         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_x509revoked.c:134:31: warning: implicit declaration of function 'X509_REVOKED_get0_serialNumber' is invalid in C99 [-Wimplicit-function-declaration]
    return asn1integer_to_num(X509_REVOKED_get0_serialNumber(rev));
                              ^
ossl_x509revoked.c:134:31: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const ASN1_INTEGER *' (aka 'const struct asn1_string_st *') [-Wint-conversion]
    return asn1integer_to_num(X509_REVOKED_get0_serialNumber(rev));
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./ossl_asn1.h:31:46: note: passing argument to parameter here
VALUE asn1integer_to_num(const ASN1_INTEGER *);
                                             ^
ossl_x509revoked.c:161:12: warning: implicit declaration of function 'X509_REVOKED_get0_revocationDate' is invalid in C99 [-Wimplicit-function-declaration]
    time = X509_REVOKED_get0_revocationDate(rev);
           ^
ossl_x509req.c:ossl_x509revoked.c:161:10: warning: incompatible integer to pointer conversion assigning to 'const ASN1_TIME *' (aka 'const struct asn1_string_st *') from 'int' [-Wint-conversion]
266:5:    time = X509_REVOKED_get0_revocationDate(rev);
         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 warning: implicit declaration of function 'X509_REQ_get0_signature' is invalid in C99 [-Wimplicit-function-declaration]
    X509_REQ_get0_signature(req, NULL, &alg);
    ^
5 warnings generated.
4 warnings generated.
1 warning generated.
8 warnings generated.
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
linking shared-object ripper.bundle
make: *** [build-ext] Error 2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Hi. Similar problem. Solved with:

rvm install ruby-2.5.1 --with-openssl-dir=/usr/local/opt/openssl

You can also check if XCode is updated

I was able to solve the problem in rvm using its --with-openssl-dir option pointed to my brew version of openssl (/usr/local/opt/openssl I believe) rather than the OS’ version. Is there some option like that for rbenv? (Note: I have changed --with-openssl above to --with-openssl-dir as per Sija’s comment below.)

I commented previously that the --with-openssl-dir=$(brew --prefix openssl) would fix the problem, but today I tried to install Ruby 2.7.0 with rvm and it failed. What fixed it was, I did a brew info openssl to get some clues, and this worked:

export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Your directory may differ, it was in the output of brew info openssl, but that export fixed the problem for me.

This also worked for me:

rvm install 2.5.1 --disable-binary  --with-openssl-dir=/usr/local/Cellar/openssl/

@keithrbennett correct option name is --with-openssl-dir.

Hi! When trying to install 2.5.0-preview1, I get this

myuser$ rbenv install 2.5.0-preview1
ruby-build: definition not found: 2.5.0-preview1

See all available versions with `rbenv install --list'.

If the version you need is missing, try upgrading ruby-build:

 brew update && brew upgrade ruby-build

Then I try to upgrade ruby-build:

myuser$ brew update && brew upgrade ruby-build
Already up-to-date.
Error: ruby-build 20170914 already installed