少し前からMacではrbenvでRubyを管理していて便利だったので、FreeBSDのVPSにも導入したメモ。
切腹
$ rvm seppuku
今までありがとう。
rbenvでrubyを管理する
rbenv
$ portinstall /usr/ports/devel/rbenv
でインストール 。
ruby-build
最新の2.0-p0を使いたいのでruby-buildはgithubからインストール $ mkdir -p ~/.rbenv/plugins $ git clone git://github.com/sstephenson/ruby-build.git $ cd ruby-build; sudo install
rbenv installでビルド失敗
$ export CFLAGS=-Wno-error=shorten-64-to-32
$ rbenv install 1.9.3-p0
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/asuka/.rbenv/versions/1.9.3-p0
Downloading ruby-1.9.3-p0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/8e2fef56185cfbaf29d0c8329fc77c05
Installing ruby-1.9.3-p0...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20130307154656.47575
Results logged to /tmp/ruby-build.20130307154656.47575.log
Last 10 log lines:
x ruby-1.9.3-p0/win32/win32.c
x ruby-1.9.3-p0/win32/winmain.c
/tmp/ruby-build.20130307154656.47575/ruby-1.9.3-p0 /tmp/ruby-build.20130307154656.47575 ~
checking build system type... x86_64-unknown-freebsd9.1
checking host system type... x86_64-unknown-freebsd9.1
checking target system type... x86_64-unknown-freebsd9.1
checking whether the C compiler works... no
configure: error: in `/tmp/ruby-build.20130307154656.47575/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details
なのでソースからコンパイルしてrbenvで管理することにする
$ cd /tmp
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
$ tar xzf ruby-1.9.3-p392.tar.gz
$ cd ruby-1.9.3-p392
$ ./configure --prefix=/home/asuka/.rbenv/versions/1.9.3-p392 --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
2.0.0-p0も同様に
$ ...
$ ./configure --prefix=/home/asuka/.rbenv/versions/2.0.0-p0 --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
$ ...
原因は
不明。 一時的なものなのか。次回Rubyをアップグレードする機会が来た時に調査。