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

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

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

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

Ruby

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

Q&A

2回答

2845閲覧

rbenv 2.5.1をインストールしてRubyをインストールしたいができない

hikax

総合スコア0

rbenv

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

Ruby

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

0グッド

0クリップ

投稿2020/11/25 10:30

前提・実現したいこと

rbenv 2.5.1をインストールしてRubyをインストールしたい。
rbenv install 2.5.1
というコマンドを実行すると次のようになります。

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

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...

WARNING: ruby-2.5.1 is nearing its end of life.
It only receives critical security updates, no bug fixes.

BUILD FAILED (Ubuntu 20.04 using ruby-build 20201118)

Inspect or clean up the working tree at /tmp/ruby-build.20201125191443.867.4HwD7G
Results logged to /tmp/ruby-build.20201125191443.867.log

Last 10 log lines:
checking for ruby... false
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in /tmp/ruby-build.20201125191443.867.4HwD7G/ruby-2.5.1': configure: error: no acceptable C compiler found in $PATH See config.log' for more details

補足情報(FW/ツールのバージョンなど)

Windows10、Ubuntuを使用
Ruby初学者で「Ruby on Rails 5 速習実践ガイド」という本を読みながら進めています。

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

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

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

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

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

guest

回答2

0

no acceptable C compiler foundとあるとおりです。GCCなど、何かしらのCコンパイラを入れてください。

投稿2020/11/25 10:32

maisumakun

総合スコア145183

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

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

hikax

2020/11/25 10:44

ありがとうございます。少し調べてやってみましたが、解決せずでした。 よくわかりませんが↓こちらに沿ってDLしてインストールしてみました。(このGCCのことで合っているか不安) https://katakago.sakura.ne.jp/pgm/gcc.html 再度、rbenvのインストールを試みましたが、またエラーのような表示が出ました。 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... WARNING: ruby-2.5.1 is nearing its end of life. It only receives critical security updates, no bug fixes. BUILD FAILED (Ubuntu 20.04 using ruby-build 20201118) Inspect or clean up the working tree at /tmp/ruby-build.20201125194024.1278.xk8ma3 Results logged to /tmp/ruby-build.20201125194024.1278.log Last 10 log lines: checking for ruby... false checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/tmp/ruby-build.20201125194024.1278.xk8ma3/ruby-2.5.1': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
maisumakun

2020/11/25 10:47

WindowsではなくUbuntuの中に入れてください。aptコマンドからインストールできるはずです。
hikax

2020/11/25 12:15

ありがとうございます。 このサイトに従って、gccをインストールしましたが、 https://www.delftstack.com/ja/howto/linux/how-to-install-gcc-compiler-on-ubuntu/ 次はこのようなエラーになってしまいました。 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... WARNING: ruby-2.5.1 is nearing its end of life. It only receives critical security updates, no bug fixes. BUILD FAILED (Ubuntu 20.04 using ruby-build 20201118) Inspect or clean up the working tree at /tmp/ruby-build.20201125202511.7288.YTZC59 Results logged to /tmp/ruby-build.20201125202511.7288.log Last 10 log lines: The Ruby readline extension was not compiled. The Ruby zlib extension was not compiled. ERROR: Ruby install aborted due to missing extensions Try running `apt-get install -y libssl-dev libreadline-dev zlib1g-dev` to fetch missing dependencies. Configure options used: --prefix=/home/hikax/.rbenv/versions/2.5.1 --enable-shared LDFLAGS=-L/home/hikax/.rbenv/versions/2.5.1/lib CPPFLAGS=-I/home/hikax/.rbenv/versions/2.5.1/include hikax@panasonic-PC:~$
maisumakun

2020/11/25 12:18

途中に「apt-get install -y libssl-dev libreadline-dev zlib1g-dev」と実行すべきコマンドがでている親切なエラーメッセージです。
hikax

2020/11/25 12:22

ありがとうございます。そういうこともあるのですね。 それを実行したところ、次のような何かネガティブなような(?)メッセージが出たのですが意味が分かりません。 どうすべきかわかりますでしょうか? E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
maisumakun

2020/11/25 12:51

さっきのgccのインストールと同様、sudoを付けて実行してください。
guest

0

https://github.com/rbenv/ruby-build/wiki#suggested-build-environment

rbenvのruby-buildを使ってRubyをビルドするときに何が必要なのかは全て上に書いています。Ubuntuの場合は下記のように書いていますので、これに従って、必要なパッケージを入れてください。

# Depending on your version of Ubuntu/Debian/Mint, libgdbm6 won't be available. # In that case, try an earlier version such as libgdbm5. apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev

投稿2020/11/25 13:27

raccy

総合スコア21735

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問