I need to install ruby 2.7.5 for my react native app but I can't install 2.7.5 through rvm. I tried many things to install any ruby version, I ended up to get this configure error.
Error running './configure --prefix=/Users/myname/.rvm/rubies/ruby-2.1.1 --disable-install-doc --enable-shared',
please read /Users/myname/.rvm/log/1672107647_ruby-2.1.1/configure.log
There has been an error while running configure. Halting the installation.
Here is the configure log
configure: WARNING: you should use --build, --host, --target
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... arm-apple-darwin22.2.0
checking host system type... arm-apple-darwin22.2.0
checking target system type... arm-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I tried...
rvm install 2.7.5
rvm install ruby-2.7.5
use rbenv
install openssl
brew install openssl
rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl
all those throw same error message. After trying 4., all ruby versions are removed but still can't install any ruby version.
Please help!!!
Edit
I tried
CFLAGS="-Wno-error=implicit-function-declaration" rvm install 2.7.5
and got this error
Error running './configure --prefix=/Users/myname/.rvm/rubies/ruby-2.7.5 --with-opt-dir=/opt/homebrew/opt/libyaml:/opt/homebrew/opt/libksba:/opt/homebrew/opt/readline:/opt/homebrew/opt/zlib:/opt/homebrew/opt/openssl@1.1 --disable-install-doc --enable-shared',
please read /Users/myname/.rvm/log/1672116807_ruby-2.7.5/configure.log
There has been an error while running configure. Halting the installation.
EDIT-----
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
rvm install 2.7.5
this returns same error but I got this configure log
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... aarch64-apple-darwin22.2.0
checking host system type... aarch64-apple-darwin22.2.0
checking target system type... aarch64-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.5':
configure: error: cannot run C compiled programs. // <---- new!
If you meant to cross compile, use `--host'.
See `config.log' for more details
------ EDIT -------- after 2days, I try to install 2.7.6 and got this message again.
checking for ruby... /Users/myname/.rvm/rubies/ruby-2.7.5/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... aarch64-apple-darwin22.2.0
checking host system type... aarch64-apple-darwin22.2.0
checking target system type... aarch64-apple-darwin22.2.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/myname/.rvm/src/ruby-2.7.6':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Add Command Line Tools:
Ensure the command line tools are correctly installed. We might need to reinstall Xcode after OS upgrades.
Here are the exact steps to follow assuming we have openssl installed
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
rvm install 2.7.5