Search code examples
rubymacosopenssljekyllapple-silicon

How to solve OpenSSL error during install of ruby 3.1.3 for Mac


I'm getting the below error when I try to install ruby-install ruby 3.1.3 (following instructions to install Jeykll). I think the issue is this link says ruby versions greater than 3.1 require OpenSSL 3, but when I run ruby-install ruby 3.1.3, it installs OpenSSL 1.1, which I think is being linked to and causing the install to fail. RUBY_CONFIGURE_OPTS is set correctly as per the github insructions.

ossl_ts.c:829:5: error: incomplete definition of type 'struct TS_verify_ctx'
    TS_VERIFY_CTX_set_certs(ctx, x509inter);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openssl_missing.h:215:46: note: expanded from macro 'TS_VERIFY_CTX_set_certs'
#  define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openssl_missing.h:195:52: note: expanded from macro 'TS_VERIFY_CTS_set_certs'
#  define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
                                              ~~~~~^
/opt/homebrew/Cellar/openssl@3/3.1.3/include/openssl/ts.h:407:16: note: forward declaration of 'struct TS_verify_ctx'
typedef struct TS_verify_ctx TS_VERIFY_CTX;
               ^
1 warning and 1 error generated.
make[2]: *** [ossl_ts.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 3.1.3 failed!

How would I solve this?

Relevant links I've tried following steps of that don't seem to solve the problem: 1, 2, 3, 4, 5


Solution

  • It could be an issue with the arguments. Try the below

    export CONFIGURE_ARGS=""                                                   
    for ext in openssl readline libyaml zlib; do
      CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-$ext-dir=$(brew --prefix $ext)"
    done