rbenv で Ruby1.8.7-p358 インストールするも GCC がなんやら言われた時の対応策
Ruby技術者認定試験を受けようと思い立ち、 Mac OS X 10.8.2 へ Ruby1.8.7 を rbenv 経由でインストールせんとす。 そこで GCC やらなんやらにガタガタ言われての対応を以下に。
|
|
rbenv install するも GCC がほげほげとエラー
rbenv install 1.8.7-p358
ERROR: This package must be compiled with GCC, but ruby-build couldn’t
find a suitable gcc
executable on your system. Please install GCC
and try again.
DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the gcc
executable is a symlink to
llvm-gcc
, a modified version of GCC which outputs LLVM bytecode.
For most programs the llvm-gcc
compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
llvm-gcc
. To build older versions of Ruby you must have the official
GCC compiler installed on your system.
TO FIX THE PROBLEM: Install the official GCC compiler using these packages: https://github.com/kennethreitz/osx-gcc-installer/downloads
You will need to install the official GCC compiler to build older
versions of Ruby even if you have installed Apple’s Command Line Tools
for Xcode package. The Command Line Tools for Xcode package only
includes llvm-gcc
.
BUILD FAILED
zsh: exit 1
## 参考1
<a href="http://d.hatena.ne.jp/shio_chan/20120125/1327513477">rbenvのインストール - メモ帳</a>を参考に
<a href="https://github.com/kennethreitz/osx-gcc-installer/downloads">Downloads · kennethreitz/osx-gcc-installer</a>
からpkgをダウンロードしてインストール。
## GCCインストール後に rbenv install もエラー
```c
# rbenv install 1.8.7-p358
Downloading http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz...
Installing ruby-1.8.7-p358...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/rz/l0r480g501z5g0l2bj4h7hfh0000gn/T/ruby-build.20121020155254.1500
Results logged to /var/folders/rz/l0r480g501z5g0l2bj4h7hfh0000gn/T/ruby-build.20121020155254.1500.log
Last 10 log lines:
cc -dynamic -bundle -undefined suppress -flat_namespace -o ../../../.ext/i686-darwin12.2.0/racc/cparse.bundle cparse.o -L. -L../../.. -L. -L'/Users/jipp/.rbenv/versions/1.8.7-p358/lib' -ldl -lobjc
ld: warning: directory not found for option '-L/Users/jipp/.rbenv/versions/1.8.7-p358/lib'
compiling readline
/usr/bin/gcc-4.2 -I. -I../.. -I../../. -I../.././ext/readline -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -I'/Users/jipp/.rbenv/versions/1.8.7-p358/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/jipp/.rbenv/versions/1.8.7-p358/include' -fno-common -g -O2 -pipe -fno-common -c readline.c
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: error: (Each undeclared identifier is reported only once
readline.c:730: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make: *** [all] Error 1
zsh: exit 1
参考2
osxにてrbenvを使ってインストールしたrubyのアーキテクチャーがまちまちに、、、 - 駄日記がヒット。 参考にして調査。
readline のバージョン
|
|
arch は x86_64
|
|
以下をexport した
|
|
再々実行 rbenv install
|
|
うまくいったようだ
確認
|
|
まいっか