当我尝试使用命令安装 ruby 2.7.2 时
rvm install 2.7.2 --with-openssl-dir=/opt/homebrew/opt/[email protected]
出现如下错误:
Error running '__rvm_make -j16',
please read /Users/bytedance/.rvm/log/1708932950_ruby-2.7.2/make.log
make.log 的有用信息是:
command(2): __rvm_make -j16
++ make -j16
BASERUBY = /usr/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99 -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/arm64-darwin23 -I./include -I. -I./enc/unicode/12.1.0
CPPFLAGS = -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -Wl,-undefined,dynamic_lookup -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/[email protected]/lib -install_name /Users/bytedance/.rvm/rubies/ruby-2.7.2/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.2 -fstack-protector-strong -framework Security -framework Foundation -fstack-protector-strong -framework Security -framework Foundation
环境是:
苹果M3 Max
macOS 14.2.1
Xcode 15.2
我发现在某些 macOS 更新后构建 Ruby 时 OpenSSL 会中断。
确保 XCode 设置正确:
xcode-select --install
重新安装 OpenSSL:
brew reinstall [email protected]
再次尝试安装ruby:
rvm get stable
rvm install 2.7.2 --with-openssl-dir=`brew --prefix [email protected]`