While installing the ruby 2.7.2 I'm getting this error:
Error running '__rvm_make -j10',
please read /Users/rifa.fauzi/.rvm/log/1692949367_ruby-2.7.2/make.log
There has been an error while running make. Halting the installation.
And when I checked the make.log file, here's the error:

CFLAGS = -w -ggdb3 -Wno-error=implicit-function-declaration -std=gnu99 -fno-common -pipe
compiling error.c
compiling regerror.c
./miniruby -I./lib -I. -I.ext/common ./tool/transform_mjit_header.rb "gcc -w -ggdb3 -Wno-error=implicit-function-declaration -std=gnu99 -fno-common -pipe " rb_mjit_header.h .ext/include/arm64-darwin22/rb_mjit_min_header-2.7.2.h
compiling dataerror.c
ossl_pkey_rsa.c:942:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
1 error generated.
make[2]: *** [ossl_pkey_rsa.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
Fyi, I installed the ruby using RVM (rvm install 2.7.2) from this: https://rvm.io/rvm/security#alternatives
I already googling about the errors, but still can't find any solution.
Since openssl 3 is required for many many apps, you want to show ruby how to find the right version without disturbing it:
brew install [email protected]
PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig rvm install 2.7.2
The reason it sucks is there’s two ways to look for C libraries on unix systems: try a standard name, or specify some paths to both header files (-I flags to the compiler) and library paths (-L flags to the compiler). Since there’s TWO paths you need to be successful, and if they mismatch versions you can get all kinds of errors that are relatively obtuse, someone invented a script called pkg-config that if you run pkg-config --libs openssl it’ll give you the flags for linking openssl at the end, and pkg-config --cflags openssl the flags for compiling source files that use openssl.
Ruby’s --with-openssl-dir sets the directory for the first thing: manually -L and -I to the compiler. A bit old school, a common way to do stuff prior to pkg-config. It started with autoconf as far as I know, and ruby copied its homework. All well and good.
The extconf.rb for the openssl extension is trying to do All The Things: “if it’s windows, try this, if there’s a pkgconfig file, use that, if not, use the --with-openssl-dir flags, if not, try the usual locations, hope we get something that works”
And you might notice that pkgconfig comes first there. So that with flag does nothing at all … if your openssl has pkgconfig.
I think that was added in openssl 1.1.
So 1.0 would work fine when it was the main openssl. 1.1 worked fine when it was the main one. Once openssl 2 and 3 came out, 1.1's pkgconfig file got hidden in its private homebrew directory.
And the --with-openssl-dir flag, while valid, doesn’t actually do anything if any openssl has a pkgconfig.
So, forcing it to use the right pkgconfig with the environment variable that pkg-config accepts makes the ruby extconf.rb find the correct openssl.
you can see how it affects it like so:
:; pkg-config --cflags openssl
-I/opt/homebrew/Cellar/openssl@3/3.2.0/include
:; PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig pkg-config --cflags openssl
-I/opt/homebrew/Cellar/[email protected]/1.1.1w/include
Finally, I can solve this problem by following this: https://github.com/postmodern/ruby-install/issues/409#issuecomment-926767470
In my Mac, the default OpenSSL is version 3 and if based on spickermann answer, Ruby 2.7.x doesn't support OpenSSL 3 and will require OpenSSL 1. Then to fix this issue, you need to uninstall your OpenSSL 3:
brew uninstall opensslbrew uninstall openssl@3brew uninstall [email protected]Then install OpenSSL 1 using brew:
brew install [email protected]Last, install your ruby 2.7.2 using rvm and OpenSSL 1:
rvm install 2.7.2 -- --with-openssl-dir=$(brew --prefix [email protected])This solved my issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With