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

2

5

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

Poul answered 5/10, 2023 at 23:20 Comment(0)
B
22

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
Blankenship answered 6/10, 2023 at 4:29 Comment(1)
See Yeasin's answer which provides a simpler solution.Extractive
S
6

For 3.3.1 users this might help

rvm install 3.3.1 --with-openssl-dir=$(brew --prefix openssl)

more info - Official RVM Github

Sovran answered 2/6 at 19:23 Comment(2)
This answer is a simpler solution than the accepted one, and works as well.Anglin
This worked for me for ruby 3.3.4Extractive

© 2022 - 2024 — McMap. All rights reserved.