Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 2.7.4 & 3.0.0 fails on macOS v11.2.3 (Big Sur): undeclared identifier RSA_SSLV23_PADDING

Tags:

ruby

openssl

I am trying to install Ruby 2.7.4 and Ruby 3 on an Intel macOS v11.2.3 (Big Sur), and I'm seeing the following error during compilation (installing using ruby-install (https://github.com/postmodern/ruby-install). I'm seeing the following error:

                                                   ^
ossl_pkey_rsa.c:942:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
    DefRSAConst(SSLV23_PADDING);
    ^
ossl_pkey_rsa.c:877:58: note: expanded from macro 'DefRSAConst'
#define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
                                                         ^
<scratch space>:144:1: note: expanded from here
RSA_SSLV23_PADDING
^
107 warnings and 1 error generated.
make[2]: *** [ossl_pkey_rsa.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 2.7.4 failed!

Also, FYI:

openssl version

Output:

LibreSSL 2.8.3
like image 426
Steve Robinson Avatar asked Dec 10 '25 16:12

Steve Robinson


2 Answers

If you already are using rvm to install Ruby interpreter versions and have openssl@3 installed, you can fix it by running the following:

rvm install 3.2.2 --with-openssl-dir=$(brew --prefix openssl@3)

If you don't have openssl@3 installed yet, you can install it with:

brew install openssl@3

I found this solution in this GitHub issue.

like image 175
Uilque Messias Avatar answered Dec 13 '25 11:12

Uilque Messias


For something similar with rvm, just uninstall openssl@3 using Homebrew and instead install [email protected].

In recent RVM versions, this has been fixed, but still needs path to OpenSSL.

rvm install ruby-<version> --with-openssl-dir=$(brew --prefix [email protected])

like image 41
whizzzkid Avatar answered Dec 13 '25 11:12

whizzzkid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!