Ubuntu 14.04 LTS(Trusty Tahr)に ruby-build で ruby 2.1.1 インストール失敗、そんなとき。

このエントリーをはてなブックマークに追加
はてなブックマーク - Ubuntu 14.04 LTS(Trusty Tahr)に ruby-build で ruby 2.1.1 インストール失敗、そんなとき。
Facebook にシェア
[`yahoo` not found]
[`livedoor` not found]
[`friendfeed` not found]
[`tweetmeme` not found]

Ubuntu 14.04 デイリービルド20140326版

Ubuntu 14.04 LTS(Trusty Tahr)ruby-build で ruby 2.1.1 コンパイルしようとしたけど失敗、そんなとき。
先人の知恵はすばらしいですね。
Build failure on 2.x and solution (related to readline) · Issue #526 · sstephenson/ruby-build

これで解決。

$ curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1

rbenv fails to install 2.1.0 on ubuntu 14.04 · Issue #528 · sstephenson/ruby-build
で2.1.0でも使えたよっていう情報があるので2.1.0使いたい人もおk。

パッチreadline.patchのコメントによるとこんな感じ。

+unless readline.have_type("r1_hook_func_t")
+  # rl_hook_func_t is available since readline-4.2 (2001).
+  # Function is removed at readline-6.3 (2014).
+  # However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
+  $DEFS << "-Dr1_hook_func_t=Function"
+end

Functionが2014年のreadline-6.3で削除されたのが原因ということらしい。

【経緯】

$ rbenv  install 2.1.1
...(省略)
compiling ossl_ocsp.c
linking shared-object nkf.so
compiling ossl_x509store.c
make[2]: Leaving directory `/tmp/ruby-build.20140328232411.8125/ruby-2.0.0-p353/ext/nkf'
compiling ossl_ssl.c
compiling ossl_pkey_dsa.c
compiling ossl_digest.c
compiling ossl.c
compiling ossl_config.c
compiling ossl_pkcs7.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20140328232411.8125/ruby-2.0.0-p353/ext/openssl'
make[1]: Leaving directory `/tmp/ruby-build.20140328232411.8125/ruby-2.0.0-p353'
make: *** [build-ext] Error 2

Error で grep してみるとこんな感じ。どうもGoogle検索してもreadlineが問題みたい。

$ cat /tmp/ruby-build.20140328232411.8125.log | grep Error
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make: *** [build-ext] Error 2

でも

$ dpkg --list | grep readline
ii  libreadline-dev:amd64               6.3-4ubuntu1                          amd64        GNU readline and history libraries, development files
ii  libreadline5:amd64                  5.2+dfsg-2                            amd64        GNU readline and history libraries, run-time libraries
ii  libreadline6:amd64                  6.3-4ubuntu1                          amd64        GNU readline and history libraries, run-time libraries
ii  libreadline6-dev:amd64              6.3-4ubuntu1                          amd64        GNU readline and history libraries, development files
ii  php5-readline                       5.5.9+dfsg-1ubuntu2                   amd64        Readline module for php5
ii  readline-common                     6.3-4ubuntu1                          all          GNU readline and history libraries, common files

はいってんだよなー。devはいってるし問題ないんじゃー?

もう一丁。「error: 'Function' undeclared 」とかいわれてるし。。。

$ cat /tmp/ruby-build.20140328232411.8125.log | grep readline
ruby-2.0.0-p353/test/readline/
ruby-2.0.0-p353/test/readline/test_readline.rb
ruby-2.0.0-p353/test/readline/test_readline_history.rb
ruby-2.0.0-p353/ext/readline/
ruby-2.0.0-p353/ext/readline/README
ruby-2.0.0-p353/ext/readline/depend
ruby-2.0.0-p353/ext/readline/README.ja
ruby-2.0.0-p353/ext/readline/extconf.rb
ruby-2.0.0-p353/ext/readline/readline.c
configuring readline
make[2]: Entering directory `/tmp/ruby-build.20140328232411.8125/ruby-2.0.0-p353/ext/readline'
compiling readline.c
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)
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20140328232411.8125/ruby-2.0.0-p353/ext/readline'
make[1]: *** [ext/readline/all] Error 2

そんなときはこれで解決。
Build failure on 2.x and solution (related to readline) · Issue #526 · sstephenson/ruby-build

先人の知恵はすばらしいですね。

$ curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1

rbenv fails to install 2.1.0 on ubuntu 14.04 · Issue #528 · sstephenson/ruby-build
で2.1.0でも使えたよっていう情報があるので2.1.0使いたい人もおk。

Popular Posts:

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*