0

我无法安装 ruby​​ 3.0.3。尝试了许多不同的选择。

rbenv install 3.0.3
Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
Installed openssl-1.1.1l to /Users/admin/.rbenv/versions/3.0.3

Downloading ruby-3.0.3.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz
Installing ruby-3.0.3...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 12.2.1 using ruby-build 20220125)

Inspect or clean up the working tree at /var/folders/7_/240gy0092fj2gcm9bvzyls480000gp/T/ruby-build.20220214200956.30377.QArDjF
Results logged to /var/folders/7_/240gy0092fj2gcm9bvzyls480000gp/T/ruby-build.20220214200956.30377.log

Last 10 log lines:
/usr/local/include/stdlib.h:361:13: note: insert '_Nonnull' if the pointer should never be null
extern char *suboptarg;         /* getsubopt(3) external variable */
            ^
              _Nonnull
219 warnings generated.

安装日志主要由这样的行组成

In file included from /usr/local/include/stdio.h:64:
/usr/local/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
        unsigned char   *_base;
                        ^
/usr/local/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
        unsigned char   *_base;

MacOS Monterey 12.2.1,rbenv 1.2.0,ruby-build 20220125。当我在 Big Sur 时也发生了同样的事情(所以我升级了但没有运气)。

brew outdated什么都不给。我还尝试重新安装gcc命令行工具并按照brew doctor.

任何帮助表示赞赏!

4

1 回答 1

0

有很多与 openssl 链接相关的问题,可能还有其他问题。

解决方案:

brew update
brew upgrade
brew install llvm
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install 3.0.3

在此处的线程中找到答案:https ://github.com/rbenv/ruby-build/discussions/1935#discussioncomment-2267934

于 2022-02-28T18:50:24.853 回答