我是编程尝试使用RVM添加Ruby 2.2并接收以下错误的新手.我已经运行rvm get stable并尝试重新安装,但得到了同样的错误.
$ rvm reinstall ruby-2.2.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.2.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system.....
Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libksba, openssl........
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.2.0, this may take a while depending on your cpu(s)...
ruby-2.2.0 - #downloading ruby-2.2.0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12.6M 100 12.6M 0 0 892k 0 0:00:14 0:00:14 --:--:-- 1518k
ruby-2.2.0 - #extracting ruby-2.2.0 to /usr/local/rvm/src/ruby-2.2.0....
ruby-2.2.0 - #applying patch /usr/local/rvm/patches/ruby/2.2.0/fix_installing_bundled_gems.patch.
ruby-2.2.0 - #configuring..........................................................
ruby-2.2.0 - #post-configuration.
ruby-2.2.0 - #compiling.............................................................
ruby-2.2.0 - #installing..........
Error running '__rvm_make install',
showing last 15 lines of /usr/local/rvm/log/1420687911_ruby-2.2.0/install.log
psych 2.0.8
rake 10.4.2
rdoc 4.2.0
installing bundle gems: /usr/local/rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
minitest-5.4.3.gem
power_assert-0.2.2.gem
test-unit-3.0.8.gem
./tool/rbinstall.rb:723:in `chmod': Operation not permitted @ chmod_internal - /usr/local/rvm/gems/ruby-1.9.3-p392/ (Errno::EPERM)
from ./tool/rbinstall.rb:723:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-nodoc] Error 1
++ return 2
There has been an error while running make install. Halting the installation.
Run Code Online (Sandbox Code Playgroud)
当我在 M1 Macbook 上通过RVM安装 ruby 时,这个错误让我摸不着头脑:
Error running '__rvm_make -j10',
please read /Users/copmputer/.rvm/log/1640263012_ruby-2.4.0/make.log
There has been an error while running make. Halting the installation.
Run Code Online (Sandbox Code Playgroud)
首先,您需要检查文件 make.log 并查看潜在的错误是什么。就我而言,是:
error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
Run Code Online (Sandbox Code Playgroud)
我在此 GitHub 页面上找到了问题的完整解决方案。这里是:
步骤 1 在终端中运行:brew info libffi将输出以下内容:
For compilers to find libffi you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
Run Code Online (Sandbox Code Playgroud)
步骤 2 在终端中运行所有 3 个导出命令以设置环境变量。
步骤3 最后运行ruby安装命令。就我而言,是:
rvm install ruby-2.4.0
Run Code Online (Sandbox Code Playgroud)
就是这样。
如果您使用 rbenv,该 GH 线程中还有另一个工作解决方案。
RubyGems 现在更加安全,您必须安装 openssl 才能使 rvm 工作。rvm 并未附带开箱即用的最新 openssl 库,因此现在您必须添加其软件包,并在安装新 ruby 时指定 openssl 配置的路径。错误的本质并没有真正显现出来,并且在安装新的红宝石时有点痛苦,但也许将来会改变。
要验证这是否是您的情况,如果您仍然可以访问日志文件,请检查它以查看 openssl 库是否失败。或者,您可以运行ruby -ropenssl -e "puts :OK"以查看是否出现错误(这假设您安装了可以使用的不同 ruby 版本)。
如果任一情况为真,则遵循以下两个与操作系统无关的步骤:
rvm pkg install openssl
Run Code Online (Sandbox Code Playgroud)
然后要么
rvm install <ruby version here> --with-openssl-dir=$rvm_path/usr
Run Code Online (Sandbox Code Playgroud)
或者
rvm reinstall <ruby version here> --force --with-openssl-dir=$rvm_path/usr
Run Code Online (Sandbox Code Playgroud)
...基于它是新安装的还是预先安装的 ruby。
| 归档时间: |
|
| 查看次数: |
10867 次 |
| 最近记录: |