skip to Main Content

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…

  1. remove rvm and reinstall
  • rvm install 2.7.5
  • rvm install ruby-2.7.5
  1. use rbenv

  2. install openssl

  • brew install openssl
  • rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl
  1. remove rvm by using rvm implode

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/[email protected] --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/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"

export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"

export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" 
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
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

2

Answers


  1. Do you have xcode developer tools installed? Run this "xcode-select –install"

    xcode-select --install
    

    Once you have developer tools installed you may need to refer to this comment:-

    https://github.com/rbenv/ruby-build/discussions/1947#discussioncomment-2317356

    Login or Signup to reply.
  2. 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/[email protected]/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
    export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"
    
    export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
    export optflags="-Wno-error=implicit-function-declaration"
    
    export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
    CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" 
    RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
    rvm install 2.7.5
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search