我需要为我的react原生应用安装ruby 2.7.5,但是我不能通过rvm安装2.7.5。我尝试了很多方法来安装ruby版本,最后还是得到了这个配置错误。
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.
以下是配置日志
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
我试过...
1.删除rvm并重新安装
- 第一个月
rvm install ruby-2.7.5
1.使用rbenv
1.安装openssl
brew install openssl
rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl
1.删除rvm通过使用rvm内爆
所有这些都抛出相同的错误消息。尝试4.后,所有的ruby版本被删除,但仍然不能安装任何ruby版本。
请救救我!!!
我试过了CFLAGS="-Wno-error=implicit-function-declaration" rvm install 2.7.5
得到了这个错误
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.
编辑-----
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
这将返回相同的错误,但我得到了此配置日志
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
2条答案
按热度按时间0md85ypi1#
添加命令行工具:
下面是假设我们安装了openssl时要遵循的确切步骤
k10s72fa2#
您是否安装了xcode开发者工具?运行此“xcode-select --install”
一旦你安装了开发者工具,你可能需要参考这个评论:-
https://github.com/rbenv/ruby-build/discussions/1947#discussioncomment-2317356