ruby-install: Can't install ruby on M1 Mac "use of undeclared identifier 'RSA_SSLV23_PADDING'"

Description

Steps To Reproduce

Steps to reproduce the bug:

  1. $ ruby-install ruby -- --with-openssl-dir=$(brew --prefix openssl)

Expected Behavior

ruby should be installed

Actual Behavior

ossl_pkey_rsa.c:950:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
    DefRSAConst(SSLV23_PADDING);
    ^
ossl_pkey_rsa.c:885:58: note: expanded from macro 'DefRSAConst'
#define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
                                                         ^
<scratch space>:166:1: note: expanded from here
RSA_SSLV23_PADDING
^
110 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

Environment

$ ruby-install --version
ruby-install: 0.8.2
$ uname -a
Darwin macbook.fritz.box 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64
$ cc --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ openssl version
OpenSSL 3.0.0 7 sep 2021 (Library: OpenSSL 3.0.0 7 sep 2021)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

FWIW, installation of legacy versions of ruby, say 2.6 or 2.7 which require openssl@1.1 may fail when openssl3 is present on a Mac. Specifying --with-openssl-dir=$(brew --prefix openssl@1.1) might not address the issue, because of how extensions detect openssl via autotools.

To fix, specify PKG_CONFIG_PATH pointing to $(brew --prefix openssl@1.1)/lib/pkgconfig which will force autotools in extensions to detect the correct path.

In addition, libffi binding may grumble of other issues, which can be fixed by setting CFLAGS to -DUSE_FFI_CLOSURE_ALLOC

In other words:

export CFLAGS="-DUSE_FFI_CLOSURE_ALLOC"
export PKG_CONFIG_PATH="$(brew --prefix openssl@1.1)/lib/pkgconfig"
ruby-install 2.6.5 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

I had this issue with an intel mac too. It’s because homebrew now defaults openssl to openssl@3 instead of openssl@1.1

Try this:

brew install openssl@1.1
ruby-install ruby-3.0.2 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

I had this issue with an intel mac too. It’s because homebrew now defaults openssl to openssl@3 instead of openssl@1.1

Try this:

brew install openssl@1.1
ruby-install ruby-3.0.2 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

This worked on my M1 Mac as long as I uninstalled openssl@3 first … otherwise it still failed oddly (possibly since I had /opt/homebrew/opt/openssl@3/bin in my PATH not sure ).

brew uninstall --ignore-dependencies openssl@3
ruby-install ruby-3.0.1 -- --with-openssl-dir=$(brew --prefix openssl@1.1) # I needed 3.0.1 rather than 3.0.2 but close enough
brew install openssl@3 # needed due to software already installed against openssl@3

Thank you!!

Same issue observed for intel processor as well.

macos big sur

uninstall openssl@3
reinstall openssl@1.1
#open new shell
rvm reinstall "ruby-3.0.0" --with-openssl-dir=`brew --prefix openssl@1.1` --disable-binary # ok

this flow worked for me

ruby-install 0.8.3 has been released which pins the homebrew openssl dependency to openssl@1.1. Now we wait for homebrew to pull it in.

I had this issue with an intel mac too. It’s because homebrew now defaults openssl to openssl@3 instead of openssl@1.1

Try this:

brew install openssl@1.1
ruby-install ruby-3.0.2 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

I can verify that this also worked for me. Same issue, homebrew had openssl@3 installed; when I removed it and used openssl@1.1 to compile Ruby 3.0.2 it worked just fine.

After running brew uninstall openssl, brew uninstall openssl@3 and brew uninstall openssl@1.1, along with all the rm -rf suggestions along the way, I reinstalled openssl@1.1 and successfully ran ruby-install ruby-2.6.6 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

brew install openssl@1.1 export LDFLAGS=“-L/opt/homebrew/opt/openssl@1.1/lib” export CPPFLAGS=“-I/opt/homebrew/opt/openssl@1.1/include” ruby-install ruby-3.0.2 – --with-openssl-dir=$(brew --prefix openssl@1.1) it works for me

I had this issue with an intel mac too. It’s because homebrew now defaults openssl to openssl@3 instead of openssl@1.1

Try this:

brew install openssl@1.1
ruby-install ruby-3.0.2 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

This worked for me! thx🥰