【问题标题】:error installing ruby 1.9.3 on linux server在 Linux 服务器上安装 ruby​​ 1.9.3 时出错
【发布时间】:2015-07-25 20:46:03
【问题描述】:

嘿,我只是在我 ssh 进入的 linux 服务器上更新 ruby​​。我知道这有很多线程,但大多数是用于安装在 mac osx 上(我没有问题)。这是输出的错误日志:

$ rvm install 1.9.3
ruby-1.9.3-p551 - #removing src/ruby-1.9.3-p551..
Searching for binary rubies, this might take some time.
No binary rubies available for: unknown/libc-2.12/x86_64/ruby-1.9.3-p551.
Continuing with compilation. Please read 'rvm help mount' to get more 
information on binary rubies.
Checking requirements for unknown.
Install:
press any key to continue
Install: build-essential libreadline zlib1g libyaml libc6 libgdbm ncurses
press any key to continue
Requirements installation successful.
Installing Ruby from source to: /home/swampu6/.rvm/rubies/ruby-1.9.3-p551, this may take a while depending on your cpu(s)...
ruby-1.9.3-p551 - #downloading ruby-1.9.3-p551, this may take a while depending on your connection...
ruby-1.9.3-p551 - #extracting ruby-1.9.3-p551 to /home/swampu6/.rvm/src/ruby-1.9.3-p551....
ruby-1.9.3-p551 - #applying patch /home/swampu6/.rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p551 - #applying patch /home/swampu6/.rvm/patches/ruby/1.9.3/CVE-2015-1855-p484.patch.
ruby-1.9.3-p551 - #configuring.............................................
ruby-1.9.3-p551 - #post-configuration..
ruby-1.9.3-p551 - #compiling...
Error running '__rvm_make -j48',
showing last 15 lines of /home/swampu6/.rvm/log/1437856022_ruby-1.9.3-p551/make.log
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
    DLDFLAGS = -Wl,-soname,libruby.so.1.9
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
compiling version.c
compiling miniprelude.c
compiling array.c
compiling bignum.c
make: vfork: Resource temporarily unavailable
make: vfork: Resource temporarily unavailable
compiling dmyversion.c
++ return 2
There has been an error while running make. Halting the installation.

这是根据评论者请求的 make.log 的内容:

[2015-07-25 16:27:22] __rvm_make
__rvm_make ()
{
    \make "$@" || return $?
}
current path: /home/swampu6/.rvm/src/ruby-1.9.3-p551
PATH=/usr/kerberos/bin:/home/swampu6/perl5/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin:/home/swampu6/.rvm/bin:/home/swampu6/bin:/home/swampu6/.rvm/bin
command(2): __rvm_make -j48
++ make -j48
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
    DLDFLAGS = -Wl,-soname,libruby.so.1.9
    SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
compiling version.c
compiling miniprelude.c
compiling array.c
compiling bignum.c
make: vfork: Resource temporarily unavailable
make: vfork: Resource temporarily unavailable
compiling dmyversion.c
++ return 2

【问题讨论】:

  • 你运行的是什么版本的 rvm?
  • 我正在运行 rvm 1.26.11
  • 错误信息“vfork:资源暂时不可用”表明您的机器在编译过程中资源不足。可能是您的机器不够强大,无法编译 Ruby,但这似乎不太可能。您可以将 /home/swampu6/.rvm/log/1437856022_ruby-1.9.3-p551/make.log 的其余部分上传到某个地方(即要点)以便我们查看吗?

标签: ruby linux rvm


【解决方案1】:

我认为您的问题是,由于 RVM 正在尝试使用命令 __rvm_make -j48 编译 ruby​​(它告诉编译器尝试在 48 个不同的作业中并行化编译),因此您的主机系统空间不足可做所以。在我找到一个可能的解决方案之前,这里有一些高层次的想法:

  1. 生产系统通常不应该编译自己的 Ruby 版本。相反,将编译后的二进制文件发送到节点(例如,作为 Debian 包),甚至不安装 RVM。

  2. rvm 做了很多魔术来尝试向最终用户隐藏其所做的细节,但根据我的经验,这比它的价值更麻烦。使用 chruby 或 rbenv 并仅在需要时构建 Ruby。

无论如何,对于您当前的问题,我认为您最好的选择是尝试将-j 标志覆盖为较小的值。有几种方法,但先试试这个:

rvm install 1.9.3 -j 1                # from http://cheat.errtheblog.com/s/rvm

如果这没有帮助,请仔细检查 __rvm_make -j 48 中的 -j 参数是否在日志中实际更改为 1。如果是这样,请尝试较小的数字。如果没有,那么试试这个:

MAKEFLAGS=-j1 rvm install ruby-1.9.3  # from https://twitter.com/avdi/status/130720270733410305

希望是其中之一!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 2016-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    • 1970-01-01
    相关资源
    最近更新 更多