尝试使用 RVM 安装 Ruby 时运行'__rvm_make -j8'时出错



我正在尝试使用 RVM 安装 Ruby。我一直在关注RailsBridge的Installfest指南。

到目前为止,我已经安装了RVM(curl -L get.rvm.io | bash -s stable(并将RVM配置为使用自制软件(rvm autolibs homebrew(。当我在终端中输入rvm install ruby时,我得到以下输出:

ruby-2.5.1 - #removing src/ruby-2.5.1..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.13/x86_64/ruby-2.5.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jules/.rvm/rubies/ruby-2.5.1, this may take a while depending on your cpu(s)...
ruby-2.5.1 - #downloading ruby-2.5.1, this may take a while depending on your connection...
ruby-2.5.1 - #extracting ruby-2.5.1 to /Users/jules/.rvm/src/ruby-2.5.1.....
ruby-2.5.1 - #configuring......................................................|
ruby-2.5.1 - #post-configuration.
ruby-2.5.1 - #compiling....
Error running '__rvm_make -j8',
please read /Users/jules/.rvm/log/1530823409_ruby-2.5.1/make.log
There has been an error while running make. Halting the installation.

我打开了/Users/jules/.rvm/log/1530823409_ruby-2.5.1/make.log试图取得进展,但我无法从文件中收集任何含义。我粘贴了以下内容:

[2018-07-05 16:44:45] __rvm_make
__rvm_make () 
{ 
make "$@" || return $?
}
current path: /Users/jules/.rvm/src/ruby-2.5.1
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/jules/anaconda2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/jules/.rvm/bin
command(2): __rvm_make -j8
++ make -j8
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens   -fno-common -pipe 
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -I. -I.ext/include/x86_64-darwin17 -I./include -I. -I./enc/unicode/10.0.0
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib -install_name /Users/jules/.rvm/rubies/ruby-2.5.1/lib/libruby.2.5.dylib -compatibility_version 2.5 -current_version 2.5.1  -fstack-protector -framework Foundation  -fstack-protector -framework Foundation  
SOLIBS = -lpthread -lgmp -ldl -lobjc 
LANG = en_US.UTF-8
LC_ALL = 
LC_CTYPE = 
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
compiling compar.c
compiling compile.c
error: error reading '/dev/fd/7'
1 error generated.
clang: error: unable to remove file: Operation not permitted
dtrace: failed to compile script probes.d: Preprocessor failed to process input program
make: *** [probes.h] Error 1
make: *** Waiting for unfinished jobs....
++ return 2

我应该从这里去哪里?干杯!

这对我有用:

rvm install ruby-2.5.1 --with-openssl-dir=/usr/local/opt/openssl

更新:我从make中搜索了error: error reading '/dev/fd/7'.log并通过卸载Avira解决了问题:https://github.com/rvm/rvm/issues/4313。

openssl 标志修复了我的错误!如果有帮助,mymake的最后一行.log是:

openssl_missing.c:39:18: error: expected ';' after top level declarator
EVP_MD_CTX_create(void)

这对我有用:

将/usr/local/include 重命名为/usr/local/include_old

参考:macOS High Sierra 10.13 上的 c++ 标准库损坏

切换到rbenv来管理我的 ruby 版本为我解决了这个问题。它很容易通过自制brew install rbenv安装。

另请参阅 https://stackoverflow.com/a/60628648/1329214

最新更新