質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
rbenv

rbenvは、Rubyバージョン管理ツール。プロジェクトごとでRubyバージョンを切り替えることが可能です。RVMよりもシンプルで、少ない機能で動作します。本体にはRubyのビルド機能は備わっておらず、ruby-buildというツールを用いる必要があります。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Q&A

解決済

1回答

925閲覧

Ubuntu + rbenvでrubyがインストールできない

退会済みユーザー

退会済みユーザー

総合スコア0

rbenv

rbenvは、Rubyバージョン管理ツール。プロジェクトごとでRubyバージョンを切り替えることが可能です。RVMよりもシンプルで、少ない機能で動作します。本体にはRubyのビルド機能は備わっておらず、ruby-buildというツールを用いる必要があります。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

0グッド

1クリップ

投稿2019/06/03 14:14

前提・実現したいこと

OS: Ubuntu
OSバージョン: 18.04.2
rbenvバージョン: rbenv 1.1.2-2-g4e92322

rbenvでrubyをインストールしようとしたのですが,エラーが発生しています.どうすればインストールできますか?

発生している問題・エラーメッセージ

$ rbenv install 2.5.1 Mon Jun 3 22:57:43 2019 Downloading ruby-2.5.1.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2 Installing ruby-2.5.1... BUILD FAILED (Ubuntu 18.04 using ruby-build 20190423-4-gac92ec0) Inspect or clean up the working tree at /tmp/ruby-build.20190603225743.27780 Results logged to /tmp/ruby-build.20190603225743.27780.log Last 10 log lines: compiling numeric.c compiling object.c compiling pack.c compiling parse.c gcc: internal compiler error: Killed (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. Makefile:375: recipe for target 'parse.o' failed make: *** [parse.o] Error 4

/tmp/ruby-build.20190603225743.27780.logは以下のようになっていました.(文字数の関係で前略が入っています)

$ cat /tmp/ruby-build.20190603225743.27780.log ... (前略) ... config.status: creating Makefile config.status: creating ruby-2.5.pc --- Configuration summary for ruby version 2.5.1 * Installation prefix: /home/ubuntu/.rbenv/versions/2.5.1 * exec prefix: ${prefix} * arch: x86_64-linux * site arch: ${arch} * RUBY_BASE_NAME: ruby * ruby lib prefix: ${libdir}/${RUBY_BASE_NAME} * site libraries path: ${rubylibprefix}/${sitearch} * vendor path: ${rubylibprefix}/vendor_ruby * target OS: linux * compiler: gcc * with pthread: yes * enable shared libs: no * dynamic library ext: so * CFLAGS: ${optflags} ${debugflags} ${warnflags} * LDFLAGS: -L. -L/home/ubuntu/.rbenv/versions/2.5.1/lib \ -fstack-protector -rdynamic -Wl,-export-dynamic * optflags: -O3 * debugflags: -ggdb3 * warnflags: -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 \ -Wimplicit-function-declaration \ -Wdeprecated-declarations \ -Wmisleading-indentation \ -Wno-packed-bitfield-compat \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=format \ -Wimplicit-fallthrough=0 -Wduplicated-cond \ -Wrestrict * strip command: strip -S -x * install doc: yes * man page type: doc --- CC = gcc LD = ld LDSHARED = gcc -shared 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 -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -Wrestrict -std=gnu99 XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE CPPFLAGS = -I/home/ubuntu/.rbenv/versions/2.5.1/include -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/10.0.0 DLDFLAGS = -L/home/ubuntu/.rbenv/versions/2.5.1/lib -Wl,--compress-debug-sections=zlib -fstack-protector -pie SOLIBS = LANG = C.UTF-8 LC_ALL = LC_CTYPE = gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. compiling ./main.c compiling dmydln.c compiling miniinit.c compiling dmyext.c compiling miniprelude.c making dummy probes.h compiling array.c compiling bignum.c compiling class.c compiling compar.c compiling compile.c compiling complex.c compiling cont.c compiling debug.c compiling debug_counter.c compiling dir.c compiling dln_find.c compiling encoding.c compiling enum.c compiling enumerator.c compiling error.c compiling eval.c compiling file.c compiling gc.c compiling hash.c compiling inits.c compiling io.c compiling iseq.c compiling load.c compiling marshal.c compiling math.c compiling node.c compiling numeric.c compiling object.c compiling pack.c compiling parse.c gcc: internal compiler error: Killed (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. Makefile:375: recipe for target 'parse.o' failed make: *** [parse.o] Error 4

試したこと

https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04
ここにある手順で行い,再度rm -rf .rbenv/で最初からやり直しても同じ結果になりました.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

恐らく、RAM不足です。
swap領域を増やしてみて下さい

参考までに

vagrant@vagrant:~$ gcc --version gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. vagrant@vagrant:~$ free -h total used free shared buff/cache available Mem: 985M 68M 553M 5.0M 363M 762M Swap: 979M 0B 979M

の環境で2.5.1のビルドに成功しています。

投稿2019/06/03 23:33

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/06/04 01:08 編集

swap領域を調べてみたところ以下のようになっていました. $ free -h total used free shared buff/cache available Mem: 479M 285M 13M 14M 181M 168M Swap: 0B 0B 0B https://yukiosugiyama.com/blog/post-2369/ こちらを参考にswap領域を増やしたらインストールできました.ありがとうございます.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問