LoginSignup
2
2

More than 5 years have passed since last update.

rvm install 2.1.1 で失敗する問題への対処 for Arch linux

Posted at

事のあらまし

  • arch linux で、
  • rvm install 2.1.1 をやってみたところ
  • エラーになってインストールに失敗する

少し細かく見てみると

  • rvm install 2.0.0 でも同様に失敗する
  • それ以下のバージョンをインストールしてみると問題ない
  • どうやら途中でコンパイルエラーになっている模様。以下コンパイルエラー時のログ。
readline.c: In function 'Init_readline':
readline.c:1886:26: error: 'Function' undeclared (first use in this function)
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                          ^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1886:36: error: expected expression before ')' token
     rl_pre_input_hook = (Function *)readline_pre_input_hook;
                                    ^
readline.c: At top level:
readline.c:530:1: warning: 'readline_pre_input_hook' defined but not used [-Wunused-function]
 readline_pre_input_hook(void)
 ^
Makefile:227: recipe for target 'readline.o' failed
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory '/home/aka/.rvm/src/ruby-2.0.0-p451/ext/readline'
exts.mk:180: recipe for target 'ext/readline/all' failed
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory '/home/aka/.rvm/src/ruby-2.0.0-p451'
uncommon.mk:179: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2

解決策

↓の投稿では rbenv で同様ことが起こっている模様。
rbenv installで失敗する問題を解消 on Arch Linux
参考にさせていただきました。ありがとうございました。

以下、rvm を使っている場合の修正方法。

  1. パッチを入手してあてる
    以下にて修正パッチが公開されているので、あててもよし、見ながら直してもよし
    https://projects.archlinux.org/svntogit/packages.git/tree/ruby/trunk/0001-Fix-undeclared-identifier-error-by-using-the-actual-.patch?id=d54cc2645013754f6a303075eb22df1eecb7676a

  2. あらためてビルドするとおそらく通る

    $ cd [ソースがダウンロードされているディレクトリ]/src
    $ make
    $ make install

  3. ビルドが通っても、rvm use 2.1.1 とやって使う対象に設定しようとするとgemsetがどうのと言われて設定できない

  4. 何とかする。 rvm use 2.1.1@newgemset --create --default とやると gemset がよしなに作られる。

  5. rvm use 2.1.1 を改めて実行。今度はきっとうまく行く。

  6. Ruby -v で Rubyのバージョンを確認

  7. 2.1.1 になっていたらあとはEnjoy。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2